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 
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

Generated on Thu Feb 7 13:59:26 2008 for QtiPlot by  doxygen 1.5.4