CustomActionDialog.h
Go to the documentation of this file.
/***************************************************************************
File : CustomActionDialog.h
Project : QtiPlot
--------------------------------------------------------------------
Copyright : (C) 2007 by Ion Vasilief
Email (use @ for *) : ion_vasilief*yahoo.fr
Description : Custom Action dialog
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, *
* Boston, MA 02110-1301 USA *
* *
***************************************************************************/
#ifndef CustomActionDialog_H
#define CustomActionDialog_H
#include <QDialog>
#include <QXmlDefaultHandler>
class QGroupBox;
class QPushButton;
class QRadioButton;
class QComboBox;
class QListWidget;
class QLineEdit;
class QMenu;
class QToolBar;
class CustomActionDialog : public QDialog
{
Q_OBJECT
public:
CustomActionDialog( QWidget* parent, Qt::WFlags fl = 0 );
private slots:
void chooseIcon();
void chooseFile();
void chooseFolder();
QAction* addAction();
void removeAction();
void setCurrentAction(int);
void saveCurrentAction();
void addMenu();
void removeMenu();
void enableDeleteMenuBtn(const QString &);
private:
void init();
void updateDisplayList();
QAction* actionAt(int row);
void saveAction(QAction *action);
void customizeAction(QAction *action);
bool validUserInput();
void saveMenu(QMenu *menu);
QStringList d_app_shortcut_keys;
QList<QMenu *> d_menus;
QList<QToolBar *> d_app_toolbars;
QListWidget *itemsList;
QPushButton *buttonCancel, *buttonAdd, *buttonRemove, *buttonSave;
QPushButton *folderBtn, *fileBtn, *iconBtn;
QLineEdit *folderBox, *fileBox, *iconBox, *textBox, *toolTipBox, *shortcutBox;
QRadioButton *menuBtn, *toolBarBtn;
QComboBox *menuBox, *toolBarBox;
QPushButton *newMenuBtn, *removeMenuBtn;
};
class CustomActionHandler : public QXmlDefaultHandler
{
public:
CustomActionHandler(QAction *action);
bool startElement(const QString &namespaceURI, const QString &localName,
const QString &qName, const QXmlAttributes &attributes);
bool endElement(const QString &namespaceURI, const QString &localName,
const QString &qName);
bool characters(const QString &str){currentText += str; return true;};
bool fatalError(const QXmlParseException &){return false;};
QString errorString() const {return errorStr;};
QString parentName(){return d_widget_name;};
private:
bool metFitTag;
QString currentText;
QString errorStr;
QString filePath;
QString d_widget_name;
QAction *d_action;
};
class CustomMenuHandler : public QXmlDefaultHandler
{
public:
CustomMenuHandler();
bool startElement(const QString &namespaceURI, const QString &localName,
const QString &qName, const QXmlAttributes &attributes);
bool endElement(const QString &namespaceURI, const QString &localName,
const QString &qName);
bool characters(const QString &str){currentText += str; return true;};
bool fatalError(const QXmlParseException &){return false;};
QString errorString() const {return errorStr;};
QString location(){return d_location;};
QString title(){return d_title;};
private:
bool metFitTag;
QString currentText;
QString errorStr;
QString d_location, d_title;
};
#endif
CustomActionDialog::itemsList
QListWidget * itemsList
Definition: CustomActionDialog.h:82
CustomActionDialog::buttonCancel
QPushButton * buttonCancel
Definition: CustomActionDialog.h:83
CustomActionDialog::d_app_toolbars
QList< QToolBar * > d_app_toolbars
Definition: CustomActionDialog.h:80
CustomActionDialog::toolBarBox
QComboBox * toolBarBox
Definition: CustomActionDialog.h:87
CustomActionDialog::saveAction
void saveAction(QAction *action)
Definition: CustomActionDialog.cpp:444
CustomActionDialog::menuBox
QComboBox * menuBox
Definition: CustomActionDialog.h:87
CustomActionDialog::saveMenu
void saveMenu(QMenu *menu)
Definition: CustomActionDialog.cpp:653
CustomActionDialog::chooseIcon
void chooseIcon()
Definition: CustomActionDialog.cpp:477
CustomActionDialog::chooseFile
void chooseFile()
Definition: CustomActionDialog.cpp:485
CustomActionDialog
Definition: CustomActionDialog.h:44
CustomActionDialog::addMenu
void addMenu()
Definition: CustomActionDialog.cpp:558
CustomActionDialog::updateDisplayList
void updateDisplayList()
Definition: CustomActionDialog.cpp:208
CustomActionDialog::toolBarBtn
QRadioButton * toolBarBtn
Definition: CustomActionDialog.h:86
CustomActionDialog::removeAction
void removeAction()
Definition: CustomActionDialog.cpp:374
CustomActionHandler::errorString
QString errorString() const
Definition: CustomActionDialog.h:102
CustomActionDialog::fileBtn
QPushButton * fileBtn
Definition: CustomActionDialog.h:84
CustomActionDialog::newMenuBtn
QPushButton * newMenuBtn
Definition: CustomActionDialog.h:88
CustomActionDialog::init
void init()
Definition: CustomActionDialog.cpp:164
CustomActionDialog::customizeAction
void customizeAction(QAction *action)
Definition: CustomActionDialog.cpp:352
CustomActionDialog::shortcutBox
QLineEdit * shortcutBox
Definition: CustomActionDialog.h:85
CustomActionDialog::folderBtn
QPushButton * folderBtn
Definition: CustomActionDialog.h:84
CustomActionDialog::textBox
QLineEdit * textBox
Definition: CustomActionDialog.h:85
CustomActionDialog::saveCurrentAction
void saveCurrentAction()
Definition: CustomActionDialog.cpp:400
CustomActionDialog::setCurrentAction
void setCurrentAction(int)
Definition: CustomActionDialog.cpp:524
CustomActionDialog::validUserInput
bool validUserInput()
Definition: CustomActionDialog.cpp:272
CustomActionDialog::chooseFolder
void chooseFolder()
Definition: CustomActionDialog.cpp:497
CustomActionDialog::enableDeleteMenuBtn
void enableDeleteMenuBtn(const QString &)
Definition: CustomActionDialog.cpp:641
CustomActionHandler::fatalError
bool fatalError(const QXmlParseException &)
Definition: CustomActionDialog.h:101
CustomActionDialog::addAction
QAction * addAction()
Definition: CustomActionDialog.cpp:228
CustomActionDialog::actionAt
QAction * actionAt(int row)
Definition: CustomActionDialog.cpp:514
CustomActionDialog::d_menus
QList< QMenu * > d_menus
Definition: CustomActionDialog.h:79
CustomActionDialog::iconBox
QLineEdit * iconBox
Definition: CustomActionDialog.h:85
CustomActionDialog::buttonRemove
QPushButton * buttonRemove
Definition: CustomActionDialog.h:83
CustomActionHandler::characters
bool characters(const QString &str)
Definition: CustomActionDialog.h:100
CustomActionDialog::removeMenu
void removeMenu()
Definition: CustomActionDialog.cpp:596
CustomActionDialog::d_app_shortcut_keys
QStringList d_app_shortcut_keys
Definition: CustomActionDialog.h:77
CustomActionHandler::d_action
QAction * d_action
Definition: CustomActionDialog.h:111
CustomActionHandler::errorStr
QString errorStr
Definition: CustomActionDialog.h:108
CustomActionDialog::menuBtn
QRadioButton * menuBtn
Definition: CustomActionDialog.h:86
CustomActionDialog::removeMenuBtn
QPushButton * removeMenuBtn
Definition: CustomActionDialog.h:88
CustomActionDialog::buttonSave
QPushButton * buttonSave
Definition: CustomActionDialog.h:83
CustomActionDialog::iconBtn
QPushButton * iconBtn
Definition: CustomActionDialog.h:84
CustomActionHandler
Definition: CustomActionDialog.h:91
CustomActionDialog::buttonAdd
QPushButton * buttonAdd
Definition: CustomActionDialog.h:83
CustomActionDialog::fileBox
QLineEdit * fileBox
Definition: CustomActionDialog.h:85
CustomActionDialog::folderBox
QLineEdit * folderBox
Definition: CustomActionDialog.h:85
CustomActionDialog::CustomActionDialog
CustomActionDialog(QWidget *parent, Qt::WFlags fl=0)
Constructor.
Definition: CustomActionDialog.cpp:52
CustomActionHandler::d_widget_name
QString d_widget_name
Definition: CustomActionDialog.h:110
CustomActionHandler::currentText
QString currentText
Definition: CustomActionDialog.h:107
CustomActionHandler::filePath
QString filePath
Definition: CustomActionDialog.h:109
CustomActionHandler::parentName
QString parentName()
Definition: CustomActionDialog.h:103
CustomActionDialog::toolTipBox
QLineEdit * toolTipBox
Definition: CustomActionDialog.h:85