CustomActionDialog.h

Go to the documentation of this file.
00001 /***************************************************************************
00002     File                 : CustomActionDialog.h
00003     Project              : QtiPlot
00004     --------------------------------------------------------------------
00005     Copyright            : (C) 2007 by Ion Vasilief
00006     Email (use @ for *)  : ion_vasilief*yahoo.fr
00007     Description          : Custom Action dialog
00008 
00009  ***************************************************************************/
00010 
00011 /***************************************************************************
00012  *                                                                         *
00013  *  This program is free software; you can redistribute it and/or modify   *
00014  *  it under the terms of the GNU General Public License as published by   *
00015  *  the Free Software Foundation; either version 2 of the License, or      *
00016  *  (at your option) any later version.                                    *
00017  *                                                                         *
00018  *  This program is distributed in the hope that it will be useful,        *
00019  *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
00020  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
00021  *  GNU General Public License for more details.                           *
00022  *                                                                         *
00023  *   You should have received a copy of the GNU General Public License     *
00024  *   along with this program; if not, write to the Free Software           *
00025  *   Foundation, Inc., 51 Franklin Street, Fifth Floor,                    *
00026  *   Boston, MA  02110-1301  USA                                           *
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

Generated on Tue Nov 3 10:48:50 2009 for QtiPlot by  doxygen 1.6.1