mirror of
https://github.com/python-LimeReport/LimeReport.git
synced 2024-12-23 20:22:58 +03:00
Dialog Designer intergration has been finished
This commit is contained in:
parent
0692435b26
commit
7b04b6efca
@ -6,4 +6,7 @@
|
||||
<file>images/tabordertool.png</file>
|
||||
<file>images/widgettool.png</file>
|
||||
</qresource>
|
||||
<qresource prefix="/templates">
|
||||
<file>templates/Dialog.ui</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include <QDesignerFormEditorInterface>
|
||||
#include <QAction>
|
||||
#include <QDebug>
|
||||
#include <QVBoxLayout>
|
||||
#include "pluginmanager_p.h"
|
||||
//#include <QExtensionManager>
|
||||
|
||||
@ -25,14 +26,14 @@
|
||||
|
||||
namespace LimeReport{
|
||||
|
||||
DialogDesigner::DialogDesigner(QObject *parent) : QObject(parent)
|
||||
DialogDesignerManager::DialogDesignerManager(QObject *parent) : QObject(parent)
|
||||
{
|
||||
QDesignerComponents::initializeResources();
|
||||
m_formEditor = QDesignerComponents::createFormEditor(this);
|
||||
QDesignerComponents::initializePlugins(m_formEditor);
|
||||
QDesignerComponents::createTaskMenu(m_formEditor, this);
|
||||
|
||||
m_editWidgetsAction = new QAction(tr("Edit Widgets"));
|
||||
m_editWidgetsAction = new QAction(tr("Edit Widgets"), this);
|
||||
m_editWidgetsAction->setIcon(QIcon(":/images/images/widgettool.png"));
|
||||
m_editWidgetsAction->setEnabled(false);
|
||||
connect(m_editWidgetsAction, SIGNAL(triggered()), this, SLOT(slotEditWidgets()));
|
||||
@ -102,7 +103,7 @@ DialogDesigner::DialogDesigner(QObject *parent) : QObject(parent)
|
||||
|
||||
}
|
||||
|
||||
DialogDesigner::~DialogDesigner()
|
||||
DialogDesignerManager::~DialogDesignerManager()
|
||||
{
|
||||
for (int i = 0; i<m_designerToolWindows.size();++i){
|
||||
if (m_designerToolWindows[i])
|
||||
@ -113,13 +114,18 @@ DialogDesigner::~DialogDesigner()
|
||||
delete m_formEditor;
|
||||
}
|
||||
|
||||
void DialogDesigner::initToolBar(QToolBar *tb)
|
||||
void DialogDesignerManager::initToolBar(QToolBar *tb)
|
||||
{
|
||||
tb->setIconSize(QSize(16,16));
|
||||
m_formEditor->formWindowManager()->actionCopy()->setIcon(QIcon(":/report/images/copy"));
|
||||
tb->addAction(m_formEditor->formWindowManager()->actionCopy());
|
||||
m_formEditor->formWindowManager()->actionPaste()->setIcon(QIcon(":/report/images/paste"));
|
||||
tb->addAction(m_formEditor->formWindowManager()->actionPaste());
|
||||
m_formEditor->formWindowManager()->actionCut()->setIcon(QIcon(":/report/images/cut"));
|
||||
tb->addAction(m_formEditor->formWindowManager()->actionCut());
|
||||
m_formEditor->formWindowManager()->actionUndo()->setIcon(QIcon(":/report/images/undo"));
|
||||
tb->addAction(m_formEditor->formWindowManager()->actionUndo());
|
||||
m_formEditor->formWindowManager()->actionRedo()->setIcon(QIcon(":/report/images/redo"));
|
||||
tb->addAction(m_formEditor->formWindowManager()->actionRedo());
|
||||
|
||||
tb->addActions(m_modes->actions());
|
||||
@ -135,7 +141,7 @@ void DialogDesigner::initToolBar(QToolBar *tb)
|
||||
tb->addAction(m_formEditor->formWindowManager()->actionAdjustSize());
|
||||
}
|
||||
|
||||
QWidget *DialogDesigner::createFormEditor(const QString &content)
|
||||
QWidget *DialogDesignerManager::createFormEditor(const QString &content)
|
||||
{
|
||||
QDesignerFormWindowInterface* wnd = m_formEditor->formWindowManager()->createFormWindow(0, Qt::Window);
|
||||
wnd->setContents(content);
|
||||
@ -143,25 +149,32 @@ QWidget *DialogDesigner::createFormEditor(const QString &content)
|
||||
m_formEditor->objectInspector()->setFormWindow(wnd);
|
||||
wnd->editWidgets();
|
||||
|
||||
connect(wnd, SIGNAL(changed()), this, SIGNAL(dialogChanged()));
|
||||
DialogDesigner* dialogDesigner = new DialogDesigner(wnd, m_formEditor);
|
||||
|
||||
SharedTools::WidgetHost *placeholder = new SharedTools::WidgetHost(0,wnd);
|
||||
placeholder->setFrameStyle( QFrame::NoFrame | QFrame::Plain );
|
||||
placeholder->setFocusProxy( wnd );
|
||||
connect(dialogDesigner, SIGNAL(dialogChanged()), this, SLOT(slotDialogChanged()));
|
||||
connect(dialogDesigner, SIGNAL(dialogNameChanged(QString,QString)), this, SIGNAL(dialogNameChanged(QString,QString)));
|
||||
connect(dialogDesigner, SIGNAL(destroyed(QObject*)), this, SLOT(slotObjectDestroyed(QObject*)));
|
||||
|
||||
m_dialogDesigners.append(dialogDesigner);
|
||||
|
||||
return dialogDesigner;
|
||||
|
||||
return placeholder;
|
||||
}
|
||||
|
||||
QByteArray DialogDesigner::getDialogDescription(QWidget *form)
|
||||
QByteArray DialogDesignerManager::getDialogDescription(QWidget *form)
|
||||
{
|
||||
SharedTools::WidgetHost* wh = dynamic_cast<SharedTools::WidgetHost*>(form);
|
||||
if (wh){
|
||||
return wh->formWindow()->contents().toUtf8();
|
||||
QByteArray result;
|
||||
DialogDesigner* dialogDesigner = dynamic_cast<DialogDesigner*>(form);
|
||||
Q_ASSERT(dialogDesigner != NULL);
|
||||
//SharedTools::WidgetHost* wh = dynamic_cast<SharedTools::WidgetHost*>(form);
|
||||
if (dialogDesigner){
|
||||
result = dialogDesigner->dialogContent();
|
||||
//wh->formWindow()->setDirty(false);
|
||||
}
|
||||
return QByteArray();
|
||||
return result;
|
||||
}
|
||||
|
||||
void DialogDesigner::setActiveEditor(QWidget *widget)
|
||||
void DialogDesignerManager::setActiveEditor(QWidget *widget)
|
||||
{
|
||||
SharedTools::WidgetHost* wh = dynamic_cast<SharedTools::WidgetHost*>(widget);
|
||||
if (wh){
|
||||
@ -169,52 +182,70 @@ void DialogDesigner::setActiveEditor(QWidget *widget)
|
||||
}
|
||||
}
|
||||
|
||||
QWidget* DialogDesigner::widgetBox() const
|
||||
void DialogDesignerManager::setDirty(bool value)
|
||||
{
|
||||
foreach(DialogDesigner* dialogDesigner, m_dialogDesigners){
|
||||
dialogDesigner->setChanged(value);
|
||||
}
|
||||
}
|
||||
|
||||
QWidget* DialogDesignerManager::widgetBox() const
|
||||
{
|
||||
return m_widgetBox;
|
||||
}
|
||||
|
||||
QWidget* DialogDesigner::actionEditor() const
|
||||
QWidget* DialogDesignerManager::actionEditor() const
|
||||
{
|
||||
return m_actionEditor;
|
||||
}
|
||||
|
||||
QWidget* DialogDesigner::propertyEditor() const
|
||||
QWidget* DialogDesignerManager::propertyEditor() const
|
||||
{
|
||||
return m_propertyEditor;
|
||||
}
|
||||
|
||||
QWidget* DialogDesigner::objectInspector() const
|
||||
QWidget* DialogDesignerManager::objectInspector() const
|
||||
{
|
||||
return m_objectInspector;
|
||||
}
|
||||
|
||||
QWidget *DialogDesigner::signalSlotEditor() const
|
||||
QWidget *DialogDesignerManager::signalSlotEditor() const
|
||||
{
|
||||
return m_signalSlotEditor;
|
||||
}
|
||||
|
||||
QWidget *DialogDesigner::resourcesEditor() const
|
||||
QWidget *DialogDesignerManager::resourcesEditor() const
|
||||
{
|
||||
return m_resourcesEditor;
|
||||
}
|
||||
|
||||
void DialogDesigner::slotObjectDestroyed(QObject *object)
|
||||
void DialogDesignerManager::slotObjectDestroyed(QObject* object)
|
||||
{
|
||||
|
||||
QList<DialogDesigner*>::Iterator it = m_dialogDesigners.begin();
|
||||
while(it!=m_dialogDesigners.end()){
|
||||
if (*it == object){
|
||||
it = m_dialogDesigners.erase(it);
|
||||
return;
|
||||
} else {
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
for ( int i = 0; i<m_designerToolWindows.size();++i){
|
||||
m_designerToolWindows[i] = m_designerToolWindows[i] == object ? 0 : m_designerToolWindows[i];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void DialogDesigner::slotEditWidgets()
|
||||
void DialogDesignerManager::slotEditWidgets()
|
||||
{
|
||||
for (int i = 0; i<m_formEditor->formWindowManager()->formWindowCount(); ++i){
|
||||
m_formEditor->formWindowManager()->formWindow(i)->editWidgets();
|
||||
}
|
||||
}
|
||||
|
||||
void DialogDesigner::slotActiveFormWindowChanged(QDesignerFormWindowInterface *formWindow)
|
||||
void DialogDesignerManager::slotActiveFormWindowChanged(QDesignerFormWindowInterface *formWindow)
|
||||
{
|
||||
if (formWindow){
|
||||
m_editWidgetsAction->setEnabled(true);
|
||||
@ -222,7 +253,15 @@ void DialogDesigner::slotActiveFormWindowChanged(QDesignerFormWindowInterface *f
|
||||
}
|
||||
}
|
||||
|
||||
QString DialogDesigner::iconPathByName(const QString &name)
|
||||
void DialogDesignerManager::slotDialogChanged()
|
||||
{
|
||||
DialogDesigner* dialogDesigner = dynamic_cast<DialogDesigner*>(sender());
|
||||
if (dialogDesigner){
|
||||
emit dialogChanged(dialogDesigner->dialogName());
|
||||
}
|
||||
}
|
||||
|
||||
QString DialogDesignerManager::iconPathByName(const QString &name)
|
||||
{
|
||||
if (name.compare("__qt_edit_signals_slots_action") == 0)
|
||||
return ":/images/images/signalslottool.png";
|
||||
@ -233,4 +272,74 @@ QString DialogDesigner::iconPathByName(const QString &name)
|
||||
return "";
|
||||
}
|
||||
|
||||
DialogDesigner::DialogDesigner(QDesignerFormWindowInterface* wnd, QDesignerFormEditorInterface* formEditor, QWidget *parent, Qt::WindowFlags flags)
|
||||
:QWidget(parent, flags), m_formEditor(formEditor)
|
||||
{
|
||||
m_dialogName = wnd->mainContainer()->objectName();
|
||||
connect(wnd, SIGNAL(changed()), this, SIGNAL(dialogChanged()));
|
||||
connect(wnd->mainContainer(), SIGNAL(objectNameChanged(QString)), this, SLOT(slotMainContainerNameChanged(QString)));
|
||||
|
||||
m_designerHolder = new SharedTools::WidgetHost(this,wnd);
|
||||
m_designerHolder->setFrameStyle( QFrame::NoFrame | QFrame::Plain );
|
||||
m_designerHolder->setFocusProxy( wnd );
|
||||
|
||||
QVBoxLayout* l = new QVBoxLayout(this);
|
||||
l->addWidget(m_designerHolder);
|
||||
setLayout(l);
|
||||
|
||||
}
|
||||
|
||||
DialogDesigner::~DialogDesigner(){}
|
||||
|
||||
QString DialogDesigner::dialogName() const
|
||||
{
|
||||
return m_dialogName;
|
||||
}
|
||||
|
||||
void DialogDesigner::setDialogName(const QString &dialogName)
|
||||
{
|
||||
m_dialogName = dialogName;
|
||||
}
|
||||
|
||||
bool DialogDesigner::isChanged()
|
||||
{
|
||||
return m_designerHolder->formWindow()->isDirty();
|
||||
}
|
||||
|
||||
void DialogDesigner::setChanged(bool value)
|
||||
{
|
||||
m_designerHolder->formWindow()->setDirty(false);
|
||||
}
|
||||
|
||||
QByteArray DialogDesigner::dialogContent()
|
||||
{
|
||||
if (m_designerHolder && m_designerHolder->formWindow())
|
||||
return m_designerHolder->formWindow()->contents().toUtf8();
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
void DialogDesigner::undo()
|
||||
{
|
||||
Q_ASSERT(m_formEditor != NULL);
|
||||
if (m_formEditor){
|
||||
m_formEditor->formWindowManager()->actionUndo()->trigger();
|
||||
}
|
||||
}
|
||||
|
||||
void DialogDesigner::redo()
|
||||
{
|
||||
Q_ASSERT(m_formEditor != NULL);
|
||||
if (m_formEditor){
|
||||
m_formEditor->formWindowManager()->actionRedo()->trigger();
|
||||
}
|
||||
}
|
||||
|
||||
void DialogDesigner::slotMainContainerNameChanged(QString newName)
|
||||
{
|
||||
if (m_dialogName.compare(newName) != 0){
|
||||
emit dialogNameChanged(m_dialogName, newName);
|
||||
m_dialogName = newName;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -14,18 +14,48 @@ class QDesignerPropertyEditorInterface;
|
||||
class QDesignerObjectInspectorInterface;
|
||||
class QDesignerFormWindowManagerInterface;
|
||||
|
||||
namespace SharedTools{
|
||||
class WidgetHost;
|
||||
}
|
||||
|
||||
namespace LimeReport{
|
||||
|
||||
class DialogDesigner : public QObject
|
||||
class DialogDesigner : public QWidget{
|
||||
Q_OBJECT
|
||||
public:
|
||||
DialogDesigner(QDesignerFormWindowInterface *wnd, QDesignerFormEditorInterface* formEditor, QWidget *parent = Q_NULLPTR, Qt::WindowFlags flags = Qt::WindowFlags());
|
||||
~DialogDesigner();
|
||||
QString dialogName() const;
|
||||
void setDialogName(const QString &dialogName);
|
||||
bool isChanged();
|
||||
void setChanged(bool value);
|
||||
QByteArray dialogContent();
|
||||
public slots:
|
||||
void undo();
|
||||
void redo();
|
||||
signals:
|
||||
void dialogChanged();
|
||||
void dialogNameChanged(QString oldName, QString newName);
|
||||
|
||||
private slots:
|
||||
void slotMainContainerNameChanged(QString newName);
|
||||
private:
|
||||
QString m_dialogName;
|
||||
SharedTools::WidgetHost* m_designerHolder;
|
||||
QDesignerFormEditorInterface* m_formEditor;
|
||||
};
|
||||
|
||||
class DialogDesignerManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit DialogDesigner(QObject *parent = 0);
|
||||
~DialogDesigner();
|
||||
explicit DialogDesignerManager(QObject *parent = 0);
|
||||
~DialogDesignerManager();
|
||||
void initToolBar(QToolBar* tb);
|
||||
QWidget* createFormEditor(const QString& content);
|
||||
QByteArray getDialogDescription(QWidget* form);
|
||||
void setActiveEditor(QWidget* widget);
|
||||
void setDirty(bool value);
|
||||
QWidget* widgetBox() const;
|
||||
QWidget* actionEditor() const;
|
||||
QWidget* propertyEditor() const;
|
||||
@ -33,11 +63,13 @@ public:
|
||||
QWidget* signalSlotEditor() const;
|
||||
QWidget* resourcesEditor() const;
|
||||
signals:
|
||||
void dialogChanged();
|
||||
void dialogChanged(QString dialogName);
|
||||
void dialogNameChanged(QString oldName, QString newName);
|
||||
private slots:
|
||||
void slotObjectDestroyed(QObject* object);
|
||||
void slotEditWidgets();
|
||||
void slotActiveFormWindowChanged(QDesignerFormWindowInterface *formWindow);
|
||||
void slotDialogChanged();
|
||||
private:
|
||||
QString iconPathByName(const QString& name);
|
||||
private:
|
||||
@ -53,6 +85,7 @@ private:
|
||||
QAction* m_editWidgetsAction;
|
||||
QActionGroup* m_modes;
|
||||
QString m_activeWindowName;
|
||||
QList<DialogDesigner*> m_dialogDesigners;
|
||||
};
|
||||
|
||||
} // namespace LimeReport
|
||||
|
18
limereport/dialogdesigner/templates/Dialog.ui
Normal file
18
limereport/dialogdesigner/templates/Dialog.ui
Normal file
@ -0,0 +1,18 @@
|
||||
<ui version="4.0" >
|
||||
<class>$ClassName$</class>
|
||||
<widget class="QDialog" name="$ClassName$" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>$ClassName$</string>
|
||||
</property>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
BIN
limereport/images/addDialog.png
Normal file
BIN
limereport/images/addDialog.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 332 B |
BIN
limereport/images/deleteDialog.png
Normal file
BIN
limereport/images/deleteDialog.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 245 B |
@ -50,9 +50,9 @@ namespace LimeReport {
|
||||
ReportDesignWidget::ReportDesignWidget(ReportEnginePrivate *report, QMainWindow *mainWindow, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
#ifdef HAVE_QTDESIGNER_INTEGRATION
|
||||
m_dialogDesigner(new DialogDesigner(this)),
|
||||
m_dialogDesignerManager(new DialogDesignerManager(this)),
|
||||
#endif
|
||||
m_mainWindow(mainWindow), m_verticalGridStep(10), m_horizontalGridStep(10), m_useGrid(false)
|
||||
m_mainWindow(mainWindow), m_verticalGridStep(10), m_horizontalGridStep(10), m_useGrid(false), m_dialogChanged(false)
|
||||
{
|
||||
m_tabWidget = new QTabWidget(this);
|
||||
m_tabWidget->setTabPosition(QTabWidget::South);
|
||||
@ -75,6 +75,7 @@ ReportDesignWidget::ReportDesignWidget(ReportEnginePrivate *report, QMainWindow
|
||||
connect(m_report,SIGNAL(pagesLoadFinished()),this,SLOT(slotPagesLoadFinished()));
|
||||
connect(m_report,SIGNAL(cleared()),this,SIGNAL(cleared()));
|
||||
connect(m_tabWidget, SIGNAL(currentChanged(int)), this, SLOT(slotCurrentTabChanged(int)));
|
||||
connect(m_report->scriptContext(), SIGNAL(dialogDeleted(QString)), this, SLOT(slotDialogDeleted(QString)));
|
||||
|
||||
m_scriptEditor->setPlainText(report->scriptContext()->initScript());
|
||||
m_zoomer = new GraphicsViewZoomer(activeView());
|
||||
@ -84,35 +85,49 @@ ReportDesignWidget::ReportDesignWidget(ReportEnginePrivate *report, QMainWindow
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_QTDESIGNER_INTEGRATION
|
||||
connect(m_dialogDesigner, SIGNAL(dialogChanged()), this, SLOT(slotDialogChanged()));
|
||||
connect(m_dialogDesignerManager, SIGNAL(dialogChanged(QString)),
|
||||
this, SLOT(slotDialogChanged(QString)));
|
||||
connect(m_dialogDesignerManager, SIGNAL(dialogNameChanged(QString,QString)),
|
||||
this, SLOT(slotDialogNameChanged(QString,QString)));
|
||||
#endif
|
||||
}
|
||||
|
||||
DialogDesigner *ReportDesignWidget::dialogDesigner() const
|
||||
#ifdef HAVE_QTDESIGNER_INTEGRATION
|
||||
DialogDesignerManager *ReportDesignWidget::dialogDesignerManager() const
|
||||
{
|
||||
return m_dialogDesigner;
|
||||
return m_dialogDesignerManager;
|
||||
}
|
||||
|
||||
QString ReportDesignWidget::activeDialogName()
|
||||
{
|
||||
if (activeDialogPage())
|
||||
return activeDialogPage()->dialogName();
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
QWidget *ReportDesignWidget::toolWindow(ReportDesignWidget::ToolWindowType windowType)
|
||||
{
|
||||
switch (windowType) {
|
||||
case WidgetBox:
|
||||
return dialogDesigner()->widgetBox();
|
||||
return dialogDesignerManager()->widgetBox();
|
||||
case PropertyEditor:
|
||||
return dialogDesigner()->propertyEditor();
|
||||
return dialogDesignerManager()->propertyEditor();
|
||||
case ObjectInspector:
|
||||
return dialogDesigner()->objectInspector();
|
||||
return dialogDesignerManager()->objectInspector();
|
||||
case ActionEditor:
|
||||
return dialogDesigner()->actionEditor();
|
||||
return dialogDesignerManager()->actionEditor();
|
||||
case ResourceEditor:
|
||||
return dialogDesigner()->resourcesEditor();
|
||||
return dialogDesignerManager()->resourcesEditor();
|
||||
case SignalSlotEditor:
|
||||
return dialogDesigner()->signalSlotEditor();
|
||||
return dialogDesignerManager()->signalSlotEditor();
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
ReportDesignWidget::EditorTabType ReportDesignWidget::activeTabType()
|
||||
{
|
||||
QString tabType = m_tabWidget->tabWhatsThis(m_tabWidget->currentIndex());
|
||||
@ -121,20 +136,24 @@ ReportDesignWidget::EditorTabType ReportDesignWidget::activeTabType()
|
||||
return Page;
|
||||
}
|
||||
|
||||
#ifdef HAVE_QTDESIGNER_INTEGRATION
|
||||
|
||||
void ReportDesignWidget::initDialogDesignerToolBar(QToolBar *toolBar)
|
||||
{
|
||||
m_dialogDesigner->initToolBar(toolBar);
|
||||
m_dialogDesignerManager->initToolBar(toolBar);
|
||||
}
|
||||
|
||||
void ReportDesignWidget::updateDialogs()
|
||||
{
|
||||
for ( int i = 0; i<m_tabWidget->count(); ++i ){
|
||||
if (m_tabWidget->tabWhatsThis(i).compare("dialog") == 0){
|
||||
m_report->scriptContext()->changeDialog(m_tabWidget->tabText(i), m_dialogDesigner->getDialogDescription(m_tabWidget->widget(i)));
|
||||
m_report->scriptContext()->changeDialog(m_tabWidget->tabText(i), m_dialogDesignerManager->getDialogDescription(m_tabWidget->widget(i)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
bool ReportDesignWidget::useMagnet() const
|
||||
{
|
||||
return m_useMagnet;
|
||||
@ -210,21 +229,38 @@ void ReportDesignWidget::createTabs(){
|
||||
pageIndex = m_tabWidget->addTab(view,QIcon(),m_report->pageAt(i)->pageItem()->objectName());
|
||||
m_tabWidget->setTabWhatsThis(pageIndex, "page");
|
||||
}
|
||||
#ifdef HAVE_QTDESIGNER_INTEGRATION
|
||||
QWidget* dialogEditor;
|
||||
foreach(DialogDescriber::Ptr dialogDesc, m_report->scriptContext()->dialogDescribers()){
|
||||
dialogEditor = m_dialogDesigner->createFormEditor(dialogDesc->description());
|
||||
pageIndex = m_tabWidget->addTab(dialogEditor,QIcon(),dialogDesc->name());
|
||||
m_tabWidget->setTabWhatsThis(pageIndex,"dialog");
|
||||
}
|
||||
#endif
|
||||
|
||||
m_scriptEditor = new QTextEdit(this);
|
||||
pageIndex = m_tabWidget->addTab(m_scriptEditor,QIcon(),tr("Script"));
|
||||
m_tabWidget->setTabWhatsThis(pageIndex,"script");
|
||||
m_tabWidget->setCurrentIndex(0);
|
||||
|
||||
#ifdef HAVE_QTDESIGNER_INTEGRATION
|
||||
QWidget* dialogDesigner;
|
||||
foreach(DialogDescriber::Ptr dialogDesc, m_report->scriptContext()->dialogDescribers()){
|
||||
dialogDesigner = m_dialogDesignerManager->createFormEditor(dialogDesc->description());
|
||||
pageIndex = m_tabWidget->addTab(dialogDesigner,QIcon(),dialogDesc->name());
|
||||
m_tabWidget->setTabWhatsThis(pageIndex,"dialog");
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#ifdef HAVE_QTDESIGNER_INTEGRATION
|
||||
void ReportDesignWidget::createNewDialogTab(const QString& dialogName, const QByteArray& description)
|
||||
{
|
||||
QWidget* dialogDesigner = m_dialogDesignerManager->createFormEditor(description);
|
||||
int pageIndex = m_tabWidget->addTab(dialogDesigner,QIcon(),dialogName);
|
||||
m_tabWidget->setTabWhatsThis(pageIndex,"dialog");
|
||||
}
|
||||
|
||||
DialogDesigner*ReportDesignWidget::activeDialogPage()
|
||||
{
|
||||
return dynamic_cast<DialogDesigner*>(m_tabWidget->currentWidget());
|
||||
}
|
||||
#endif
|
||||
|
||||
ReportDesignWidget::~ReportDesignWidget()
|
||||
{
|
||||
delete m_zoomer;
|
||||
@ -301,6 +337,8 @@ PageDesignIntf * ReportDesignWidget::activePage()
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
QList<QGraphicsItem *> ReportDesignWidget::selectedItems(){
|
||||
return activePage()->selectedItems();
|
||||
}
|
||||
@ -321,8 +359,9 @@ void ReportDesignWidget::slotItemSelected(BaseDesignIntf *item){
|
||||
emit itemSelected(item);
|
||||
}
|
||||
|
||||
void ReportDesignWidget::saveToFile(const QString &fileName){
|
||||
bool ReportDesignWidget::saveToFile(const QString &fileName){
|
||||
|
||||
bool result = false;
|
||||
m_report->scriptContext()->setInitScript(m_scriptEditor->toPlainText());
|
||||
#ifdef HAVE_QTDESIGNER_INTEGRATION
|
||||
updateDialogs();
|
||||
@ -330,7 +369,16 @@ void ReportDesignWidget::saveToFile(const QString &fileName){
|
||||
|
||||
if (m_report->saveToFile(fileName)) {
|
||||
m_report->emitSaveFinished();
|
||||
result = true;
|
||||
}
|
||||
|
||||
#ifdef HAVE_QTDESIGNER_INTEGRATION
|
||||
if (result){
|
||||
m_dialogChanged = false;
|
||||
m_dialogDesignerManager->setDirty(false);
|
||||
}
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
bool ReportDesignWidget::save()
|
||||
@ -340,24 +388,32 @@ bool ReportDesignWidget::save()
|
||||
updateDialogs();
|
||||
#endif
|
||||
|
||||
bool result = false;
|
||||
|
||||
if (!m_report->reportFileName().isEmpty()){
|
||||
if (m_report->saveToFile()){
|
||||
m_report->emitSaveFinished();
|
||||
return true;
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
m_report->emitSaveReport();
|
||||
if (m_report->isSaved()) {
|
||||
m_report->emitSaveFinished();
|
||||
return true;
|
||||
result = true;
|
||||
}
|
||||
if (m_report->saveToFile(QFileDialog::getSaveFileName(this,tr("Report file name"),"","Report files (*.lrxml);; All files (*)"))){
|
||||
else if (m_report->saveToFile(QFileDialog::getSaveFileName(this,tr("Report file name"),"","Report files (*.lrxml);; All files (*)"))){
|
||||
m_report->emitSaveFinished();
|
||||
return true;
|
||||
result = true;
|
||||
};
|
||||
}
|
||||
return false;
|
||||
#ifdef HAVE_QTDESIGNER_INTEGRATION
|
||||
if (result){
|
||||
m_dialogChanged = false;
|
||||
m_dialogDesignerManager->setDirty(false);
|
||||
}
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
bool ReportDesignWidget::loadFromFile(const QString &fileName)
|
||||
@ -367,6 +423,7 @@ bool ReportDesignWidget::loadFromFile(const QString &fileName)
|
||||
//connectPage(m_report->pageAt(0));
|
||||
m_scriptEditor->setPlainText(m_report->scriptContext()->initScript());
|
||||
emit loaded();
|
||||
m_dialogChanged = false;
|
||||
return true;
|
||||
} else {
|
||||
QMessageBox::critical(this,tr("Error"),tr("Wrong file format"));
|
||||
@ -390,7 +447,7 @@ QString ReportDesignWidget::reportFileName()
|
||||
bool ReportDesignWidget::isNeedToSave()
|
||||
{
|
||||
if(m_report)
|
||||
return m_report->isNeedToSave();
|
||||
return (m_report->isNeedToSave() || m_dialogChanged);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -409,12 +466,20 @@ void ReportDesignWidget::undo()
|
||||
{
|
||||
if (activePage())
|
||||
activePage()->undo();
|
||||
#ifdef HAVE_QTDESIGNER_INTEGRATION
|
||||
if (activeDialogPage())
|
||||
activeDialogPage()->undo();
|
||||
#endif
|
||||
}
|
||||
|
||||
void ReportDesignWidget::redo()
|
||||
{
|
||||
if (activePage())
|
||||
activePage()->redo();
|
||||
#ifdef HAVE_QTDESIGNER_INTEGRATION
|
||||
if (activeDialogPage())
|
||||
activeDialogPage()->redo();
|
||||
#endif
|
||||
}
|
||||
|
||||
void ReportDesignWidget::copy()
|
||||
@ -667,6 +732,16 @@ void ReportDesignWidget::slotPagesLoadFinished()
|
||||
emit loaded();
|
||||
}
|
||||
|
||||
void ReportDesignWidget::slotDialogDeleted(QString dialogName)
|
||||
{
|
||||
for (int i = 0; i<m_tabWidget->count(); ++i ){
|
||||
if (m_tabWidget->tabText(i).compare(dialogName) == 0){
|
||||
delete m_tabWidget->widget(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ReportDesignWidget::slotDatasourceCollectionLoaded(const QString & /*collectionName*/)
|
||||
{
|
||||
}
|
||||
@ -685,16 +760,40 @@ void ReportDesignWidget::slotCurrentTabChanged(int index)
|
||||
}
|
||||
m_zoomer->setView(view);
|
||||
}
|
||||
#ifdef HAVE_QTDESIGNER_INTEGRATION
|
||||
if (activeTabType() == Dialog){
|
||||
m_dialogDesigner->setActiveEditor(m_tabWidget->widget(index));
|
||||
m_dialogDesignerManager->setActiveEditor(m_tabWidget->widget(index));
|
||||
}
|
||||
updateDialogs();
|
||||
#endif
|
||||
emit activePageChanged();
|
||||
}
|
||||
|
||||
#ifdef HAVE_QTDESIGNER_INTEGRATION
|
||||
|
||||
void ReportDesignWidget::slotDialogChanged()
|
||||
void ReportDesignWidget::addNewDialog()
|
||||
{
|
||||
QFile templateUi(":/templates/templates/Dialog.ui");
|
||||
templateUi.open(QIODevice::ReadOnly|QIODevice::Text);
|
||||
QString templateStr = templateUi.readAll();
|
||||
QString dialogName = m_report->scriptContext()->getNewDialogName();
|
||||
templateStr.replace("$ClassName$", dialogName);
|
||||
m_report->scriptContext()->addDialog(dialogName,templateStr.toUtf8());
|
||||
createNewDialogTab(dialogName, templateStr.toUtf8());
|
||||
}
|
||||
|
||||
void ReportDesignWidget::slotDialogChanged(QString )
|
||||
{
|
||||
m_dialogChanged = true;
|
||||
}
|
||||
|
||||
void ReportDesignWidget::slotDialogNameChanged(QString oldName, QString newName)
|
||||
{
|
||||
for (int i = 0; i < m_tabWidget->count(); ++i){
|
||||
if (m_tabWidget->tabText(i).compare(oldName) == 0)
|
||||
m_tabWidget->setTabText(i, newName);
|
||||
}
|
||||
m_report->scriptContext()->changeDialogName(oldName, newName);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -48,6 +48,7 @@ namespace LimeReport {
|
||||
class ReportEnginePrivate;
|
||||
class DataBrowser;
|
||||
class ReportDesignWindow;
|
||||
class DialogDesignerManager;
|
||||
class DialogDesigner;
|
||||
|
||||
class ReportDesignWidget : public QWidget
|
||||
@ -100,15 +101,17 @@ public:
|
||||
bool useGrid(){ return m_useGrid;}
|
||||
bool useMagnet() const;
|
||||
void setUseMagnet(bool useMagnet);
|
||||
DialogDesigner *dialogDesigner() const;
|
||||
QWidget* toolWindow(ToolWindowType windowType);
|
||||
EditorTabType activeTabType();
|
||||
#ifdef HAVE_QTDESIGNER_INTEGRATION
|
||||
void initDialogDesignerToolBar(QToolBar* toolBar);
|
||||
void updateDialogs();
|
||||
DialogDesignerManager *dialogDesignerManager() const;
|
||||
QString activeDialogName();
|
||||
DialogDesigner* activeDialogPage();
|
||||
QWidget* toolWindow(ToolWindowType windowType);
|
||||
#endif
|
||||
public slots:
|
||||
void saveToFile(const QString&);
|
||||
bool saveToFile(const QString&);
|
||||
bool save();
|
||||
bool loadFromFile(const QString&);
|
||||
void deleteSelectedItems();
|
||||
@ -140,6 +143,10 @@ public slots:
|
||||
void addPage();
|
||||
void deleteCurrentPage();
|
||||
void slotPagesLoadFinished();
|
||||
void slotDialogDeleted(QString dialogName);
|
||||
#ifdef HAVE_QTDESIGNER_INTEGRATION
|
||||
void addNewDialog();
|
||||
#endif
|
||||
private slots:
|
||||
void slotItemSelected(LimeReport::BaseDesignIntf *item);
|
||||
void slotSelectionChanged();
|
||||
@ -147,7 +154,8 @@ private slots:
|
||||
void slotSceneRectChanged(QRectF);
|
||||
void slotCurrentTabChanged(int index);
|
||||
#ifdef HAVE_QTDESIGNER_INTEGRATION
|
||||
void slotDialogChanged();
|
||||
void slotDialogChanged(QString);
|
||||
void slotDialogNameChanged(QString oldName, QString newName);
|
||||
#endif
|
||||
signals:
|
||||
void insertModeStarted();
|
||||
@ -169,13 +177,18 @@ signals:
|
||||
void pageDeleted();
|
||||
protected:
|
||||
void createTabs();
|
||||
#ifdef HAVE_QTDESIGNER_INTEGRATION
|
||||
void createNewDialogTab(const QString& dialogName,const QByteArray& description);
|
||||
#endif
|
||||
private:
|
||||
bool eventFilter(QObject *target, QEvent *event);
|
||||
private:
|
||||
ReportEnginePrivate* m_report;
|
||||
QGraphicsView *m_view;
|
||||
QTextEdit* m_scriptEditor;
|
||||
DialogDesigner* m_dialogDesigner;
|
||||
#ifdef HAVE_QTDESIGNER_INTEGRATION
|
||||
DialogDesignerManager* m_dialogDesignerManager;
|
||||
#endif
|
||||
QMainWindow *m_mainWindow;
|
||||
QTabWidget* m_tabWidget;
|
||||
GraphicsViewZoomer* m_zoomer;
|
||||
@ -184,6 +197,7 @@ private:
|
||||
int m_horizontalGridStep;
|
||||
bool m_useGrid;
|
||||
bool m_useMagnet;
|
||||
bool m_dialogChanged;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -211,11 +211,6 @@ void ReportDesignWindow::createActions()
|
||||
m_testAction->setIcon(QIcon(":/report/images/pin"));
|
||||
connect(m_testAction,SIGNAL(triggered()),this,SLOT(slotTest()));
|
||||
|
||||
// m_printReportAction = new QAction(tr("Print Report"),this);
|
||||
// m_printReportAction->setIcon(QIcon(":/report/images/print"));
|
||||
// m_printReportAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_P));
|
||||
// connect(m_printReportAction,SIGNAL(triggered()),this,SLOT(slotPrintReport()));
|
||||
|
||||
m_editLayoutMode = new QAction(tr("Edit layouts mode"),this);
|
||||
m_editLayoutMode->setIcon(QIcon(":/report/images/editlayout"));
|
||||
m_editLayoutMode->setCheckable(true);
|
||||
@ -231,15 +226,22 @@ void ReportDesignWindow::createActions()
|
||||
|
||||
m_hideLeftPanel = new QAction(tr("Hide left panel"),this);
|
||||
m_hideLeftPanel->setCheckable(true);
|
||||
// m_hideLeftPanel->setChecked(true);
|
||||
m_hideLeftPanel->setIcon(QIcon(":/report/images/hideLeftPanel"));
|
||||
connect(m_hideLeftPanel,SIGNAL(toggled(bool)), this, SLOT(slotHideLeftPanel(bool)));
|
||||
|
||||
m_hideRightPanel = new QAction(tr("Hide right panel"),this);
|
||||
m_hideRightPanel->setCheckable(true);
|
||||
// m_hideRightPanel->setChecked(true);
|
||||
m_hideRightPanel->setIcon(QIcon(":/report/images/hideRightPanel"));
|
||||
connect(m_hideRightPanel,SIGNAL(toggled(bool)), this, SLOT(slotHideRightPanel(bool)));
|
||||
#ifdef HAVE_QTDESIGNER_INTEGRATION
|
||||
m_deleteDialogAction = new QAction(tr("Delete dialog"), this);
|
||||
m_deleteDialogAction->setIcon(QIcon(":/report//images/deleteDialog"));
|
||||
connect(m_deleteDialogAction, SIGNAL(triggered()), this, SLOT(slotDeleteDialog()));
|
||||
|
||||
m_addNewDialogAction = new QAction(tr("Add new dialog"), this);
|
||||
m_addNewDialogAction->setIcon(QIcon(":/report//images/addDialog"));
|
||||
connect(m_addNewDialogAction, SIGNAL(triggered()), this, SLOT(slotAddNewDialog()));
|
||||
#endif
|
||||
}
|
||||
|
||||
void ReportDesignWindow::createReportToolBar()
|
||||
@ -252,7 +254,6 @@ void ReportDesignWindow::createReportToolBar()
|
||||
m_reportToolBar->setObjectName("reportTools");
|
||||
createItemsActions();
|
||||
m_reportToolBar->addSeparator();
|
||||
//m_reportToolBar->addAction(m_editLayoutMode);
|
||||
m_reportToolBar->addAction(m_addHLayout);
|
||||
m_reportToolBar->addSeparator();
|
||||
m_reportToolBar->addAction(m_deleteItemAction);
|
||||
@ -286,6 +287,9 @@ void ReportDesignWindow::createToolBars()
|
||||
|
||||
m_mainToolBar->addAction(m_newPageAction);
|
||||
m_mainToolBar->addAction(m_deletePageAction);
|
||||
#ifdef HAVE_QTDESIGNER_INTEGRATION
|
||||
m_mainToolBar->addAction(m_addNewDialogAction);
|
||||
#endif
|
||||
m_mainToolBar->addSeparator();
|
||||
|
||||
m_mainToolBar->addAction(m_copyAction);
|
||||
@ -582,6 +586,11 @@ void ReportDesignWindow::createDialogDesignerToolBar()
|
||||
{
|
||||
m_dialogDesignerToolBar = addToolBar(tr("Dialog Designer Tools"));
|
||||
m_dialogDesignerToolBar->setObjectName("DialogDesignerTools");
|
||||
m_dialogDesignerToolBar->addAction(m_saveReportAction);
|
||||
m_dialogDesignerToolBar->addAction(m_previewReportAction);
|
||||
m_dialogDesignerToolBar->addSeparator();
|
||||
m_dialogDesignerToolBar->addAction(m_deleteDialogAction);
|
||||
m_dialogDesignerToolBar->addSeparator();
|
||||
m_reportDesignWidget->initDialogDesignerToolBar(m_dialogDesignerToolBar);
|
||||
m_dialogTools << m_dialogDesignerToolBar;
|
||||
}
|
||||
@ -1257,6 +1266,7 @@ void ReportDesignWindow::slotActivePageChanged()
|
||||
switch (m_editorTabType) {
|
||||
case ReportDesignWidget::Dialog:
|
||||
m_dialogEditorsState = saveState();
|
||||
m_scriptBrowser->updateDialogsTree();
|
||||
break;
|
||||
default:
|
||||
m_pageEditorsState = saveState();
|
||||
@ -1388,6 +1398,20 @@ void ReportDesignWindow::slotPageDeleted()
|
||||
m_deletePageAction->setEnabled(m_reportDesignWidget->report()->pageCount()>1);
|
||||
}
|
||||
|
||||
#ifdef HAVE_QTDESIGNER_INTEGRATION
|
||||
void ReportDesignWindow::slotDeleteDialog()
|
||||
{
|
||||
if ( m_editorTabType == ReportDesignWidget::Dialog ){
|
||||
m_reportDesignWidget->report()->scriptContext()->deleteDialog(m_reportDesignWidget->activeDialogName());
|
||||
}
|
||||
}
|
||||
|
||||
void ReportDesignWindow::slotAddNewDialog()
|
||||
{
|
||||
m_reportDesignWidget->addNewDialog();
|
||||
}
|
||||
#endif
|
||||
|
||||
void ReportDesignWindow::closeEvent(QCloseEvent * event)
|
||||
{
|
||||
if (checkNeedToSave()){
|
||||
|
@ -119,6 +119,10 @@ private slots:
|
||||
void slotLoadRecentFile(const QString fileName);
|
||||
void slotPageAdded(PageDesignIntf* );
|
||||
void slotPageDeleted();
|
||||
#ifdef HAVE_QTDESIGNER_INTEGRATION
|
||||
void slotDeleteDialog();
|
||||
void slotAddNewDialog();
|
||||
#endif
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *event);
|
||||
void resizeEvent(QResizeEvent *);
|
||||
@ -217,6 +221,10 @@ private:
|
||||
QAction* m_addHLayout;
|
||||
QAction* m_hideLeftPanel;
|
||||
QAction* m_hideRightPanel;
|
||||
#ifdef HAVE_QTDESIGNER_INTEGRATION
|
||||
QAction* m_deleteDialogAction;
|
||||
QAction* m_addNewDialogAction;
|
||||
#endif
|
||||
QMenu* m_recentFilesMenu;
|
||||
|
||||
QSignalMapper* m_bandsAddSignalsMap;
|
||||
|
@ -1065,6 +1065,7 @@ void DialogDescriber::setDescription(const QByteArray &description)
|
||||
void ScriptEngineContext::addDialog(const QString& name, const QByteArray& description)
|
||||
{
|
||||
m_dialogs.push_back(DialogDescriber::create(name,description));
|
||||
emit dialogAdded(name);
|
||||
}
|
||||
|
||||
bool ScriptEngineContext::changeDialog(const QString& name, const QByteArray& description)
|
||||
@ -1072,6 +1073,37 @@ bool ScriptEngineContext::changeDialog(const QString& name, const QByteArray& de
|
||||
foreach( DialogDescriber::Ptr describer, m_dialogs){
|
||||
if (describer->name().compare(name) == 0){
|
||||
describer->setDescription(description);
|
||||
{
|
||||
QList<DialogPtr>::Iterator it = m_createdDialogs.begin();
|
||||
while(it!=m_createdDialogs.end()){
|
||||
if ((*it)->objectName()==name){
|
||||
it = m_createdDialogs.erase(it);
|
||||
} else {
|
||||
++it;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ScriptEngineContext::changeDialogName(const QString& oldName, const QString& newName)
|
||||
{
|
||||
foreach( DialogDescriber::Ptr describer, m_dialogs){
|
||||
if (describer->name().compare(oldName) == 0){
|
||||
describer->setName(newName);
|
||||
{
|
||||
QList<DialogPtr>::Iterator it = m_createdDialogs.begin();
|
||||
while(it!=m_createdDialogs.end()){
|
||||
if ((*it)->objectName()==oldName){
|
||||
it = m_createdDialogs.erase(it);
|
||||
} else {
|
||||
++it;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -1106,6 +1138,7 @@ void ScriptEngineContext::deleteDialog(const QString& dialogName)
|
||||
while(it!=m_dialogs.end()){
|
||||
if ((*it)->name()==dialogName){
|
||||
it = m_dialogs.erase(it);
|
||||
emit dialogDeleted(dialogName);
|
||||
} else {
|
||||
++it;
|
||||
}
|
||||
@ -1188,6 +1221,10 @@ QDialog* ScriptEngineContext::createDialog(DialogDescriber* cont)
|
||||
buffer.open(QIODevice::ReadOnly);
|
||||
QDialog* dialog = dynamic_cast<QDialog*>(loader.load(&buffer));
|
||||
m_createdDialogs.push_back(QSharedPointer<QDialog>(dialog));
|
||||
if (cont->name().compare(dialog->objectName())){
|
||||
cont->setName(dialog->objectName());
|
||||
emit dialogNameChanged(dialog->objectName());
|
||||
}
|
||||
return dialog;
|
||||
}
|
||||
|
||||
@ -1225,6 +1262,18 @@ QDialog* ScriptEngineContext::getDialog(const QString& dialogName)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
QString ScriptEngineContext::getNewDialogName()
|
||||
{
|
||||
QString result = "Dialog";
|
||||
int index = m_dialogs.size() - 1;
|
||||
while (containsDialog(result)){
|
||||
index++;
|
||||
result = QString("Dialog%1").arg(index);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif
|
||||
QString ScriptEngineContext::initScript() const
|
||||
{
|
||||
|
@ -146,15 +146,21 @@ public:
|
||||
#ifdef HAVE_UI_LOADER
|
||||
void addDialog(const QString& name, const QByteArray& description);
|
||||
bool changeDialog(const QString& name, const QByteArray &description);
|
||||
bool changeDialogName(const QString& oldName, const QString& newName);
|
||||
bool previewDialog(const QString& dialogName);
|
||||
bool containsDialog(const QString& dialogName);
|
||||
const QVector<DialogDescriber::Ptr>& dialogDescribers(){return m_dialogs;}
|
||||
void deleteDialog(const QString& dialogName);
|
||||
QDialog *getDialog(const QString &dialogName);
|
||||
QString getNewDialogName();
|
||||
#endif
|
||||
void clear();
|
||||
QString initScript() const;
|
||||
void setInitScript(const QString& initScript);
|
||||
signals:
|
||||
void dialogNameChanged(QString dialogName);
|
||||
void dialogDeleted(QString dialogName);
|
||||
void dialogAdded(QString dialogName);
|
||||
protected:
|
||||
QObject* createElement(const QString& collectionName,const QString& elementType);
|
||||
int elementsCount(const QString& collectionName);
|
||||
|
@ -175,5 +175,7 @@
|
||||
<file alias="/images/addBand">images/addBand2.png</file>
|
||||
<file alias="/images/editMode">images/edit_control_4_24.png</file>
|
||||
<file alias="/images/logo32">images/logo_32x32_1.png</file>
|
||||
<file alias="/images/addDialog">images/addDialog.png</file>
|
||||
<file alias="/images/deleteDialog">images/deleteDialog.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
@ -59,6 +59,7 @@ void ScriptBrowser::setReportEditor(ReportDesignWidget* report)
|
||||
m_report=report;
|
||||
connect(m_report,SIGNAL(cleared()),this,SLOT(slotClear()));
|
||||
connect(m_report,SIGNAL(loaded()),this,SLOT(slotUpdate()));
|
||||
connect(m_report->scriptContext(), SIGNAL(dialogAdded(QString)), this, SLOT(slotDialogAdded(QString)));
|
||||
updateFunctionTree();
|
||||
}
|
||||
|
||||
@ -138,6 +139,11 @@ void ScriptBrowser::slotUpdate()
|
||||
updateFunctionTree();
|
||||
}
|
||||
|
||||
void ScriptBrowser::slotDialogAdded(QString)
|
||||
{
|
||||
updateDialogsTree();
|
||||
}
|
||||
|
||||
#ifdef HAVE_UI_LOADER
|
||||
void ScriptBrowser::on_tbAddDialog_clicked()
|
||||
{
|
||||
@ -157,7 +163,7 @@ void ScriptBrowser::on_tbAddDialog_clicked()
|
||||
if (!m_report->scriptContext()->containsDialog(dialog->objectName())){
|
||||
file.seek(0);
|
||||
m_report->scriptContext()->addDialog(dialog->objectName(),file.readAll());
|
||||
updateDialogsTree();
|
||||
//updateDialogsTree();
|
||||
} else {
|
||||
QMessageBox::critical(this,tr("Error"),tr("Dialog with name: %1 already exists").arg(dialog->objectName()));
|
||||
}
|
||||
|
@ -62,6 +62,7 @@ protected:
|
||||
private slots:
|
||||
void slotClear();
|
||||
void slotUpdate();
|
||||
void slotDialogAdded(QString);
|
||||
#ifdef HAVE_UI_LOADER
|
||||
void on_tbAddDialog_clicked();
|
||||
void on_tbRunDialog_clicked();
|
||||
|
Loading…
Reference in New Issue
Block a user