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
00064 private:
00065 void init();
00066 void updateDisplayList();
00067 void saveAction(QAction *action);
00068 void customizeAction(QAction *action);
00069 bool validUserInput();
00070 QStringList d_app_shortcut_keys;
00071
00072 QList<QMenu *> d_menus;
00073 QList<QToolBar *> d_app_toolbars;
00074
00075 QListWidget *itemsList;
00076 QPushButton *buttonCancel, *buttonAdd, *buttonRemove;
00077 QPushButton *folderBtn, *fileBtn, *iconBtn;
00078 QLineEdit *folderBox, *fileBox, *iconBox, *textBox, *toolTipBox, *shortcutBox;
00079 QRadioButton *menuBtn, *toolBarBtn;
00080 QComboBox *menuBox, *toolBarBox;
00081 };
00082
00083 class CustomActionHandler : public QXmlDefaultHandler
00084 {
00085 public:
00086 CustomActionHandler(QAction *action);
00087
00088 bool startElement(const QString &namespaceURI, const QString &localName,
00089 const QString &qName, const QXmlAttributes &attributes);
00090 bool endElement(const QString &namespaceURI, const QString &localName,
00091 const QString &qName);
00092 bool characters(const QString &str){currentText += str; return true;};
00093 bool fatalError(const QXmlParseException &){return false;};
00094 QString errorString() const {return errorStr;};
00095 QString parentName(){return d_widget_name;};
00096
00097 private:
00098 bool metFitTag;
00099 QString currentText;
00100 QString errorStr;
00101 QString filePath;
00102 QString d_widget_name;
00103 QAction *d_action;
00104 };
00105 #endif