diff --git a/limereport/dialogdesigner/dialogdesigner.pri b/limereport/dialogdesigner/dialogdesigner.pri index 37a1ea1..df76e68 100644 --- a/limereport/dialogdesigner/dialogdesigner.pri +++ b/limereport/dialogdesigner/dialogdesigner.pri @@ -15,3 +15,6 @@ QT += designer designercomponents-private SOURCES += $$PWD/lrdialogdesigner.cpp HEADERS += $$PWD/lrdialogdesigner.h + +RESOURCES += \ + $$PWD/dialogdesigner.qrc diff --git a/limereport/dialogdesigner/dialogdesigner.qrc b/limereport/dialogdesigner/dialogdesigner.qrc new file mode 100644 index 0000000..67c62fb --- /dev/null +++ b/limereport/dialogdesigner/dialogdesigner.qrc @@ -0,0 +1,9 @@ + + + images/buddytool.png + images/editform.png + images/signalslottool.png + images/tabordertool.png + images/widgettool.png + + diff --git a/limereport/dialogdesigner/images/buddytool.png b/limereport/dialogdesigner/images/buddytool.png new file mode 100644 index 0000000..4cd968b Binary files /dev/null and b/limereport/dialogdesigner/images/buddytool.png differ diff --git a/limereport/dialogdesigner/images/editform.png b/limereport/dialogdesigner/images/editform.png new file mode 100644 index 0000000..452fcd8 Binary files /dev/null and b/limereport/dialogdesigner/images/editform.png differ diff --git a/limereport/dialogdesigner/images/signalslottool.png b/limereport/dialogdesigner/images/signalslottool.png new file mode 100644 index 0000000..e80fd1c Binary files /dev/null and b/limereport/dialogdesigner/images/signalslottool.png differ diff --git a/limereport/dialogdesigner/images/tabordertool.png b/limereport/dialogdesigner/images/tabordertool.png new file mode 100644 index 0000000..7e6e2de Binary files /dev/null and b/limereport/dialogdesigner/images/tabordertool.png differ diff --git a/limereport/dialogdesigner/images/widgettool.png b/limereport/dialogdesigner/images/widgettool.png new file mode 100644 index 0000000..a52224e Binary files /dev/null and b/limereport/dialogdesigner/images/widgettool.png differ diff --git a/limereport/dialogdesigner/lrdialogdesigner.cpp b/limereport/dialogdesigner/lrdialogdesigner.cpp index cc5d258..643cf50 100644 --- a/limereport/dialogdesigner/lrdialogdesigner.cpp +++ b/limereport/dialogdesigner/lrdialogdesigner.cpp @@ -16,6 +16,8 @@ #include #include #include +#include +#include #include "pluginmanager_p.h" //#include @@ -30,64 +32,70 @@ DialogDesigner::DialogDesigner(QObject *parent) : QObject(parent) QDesignerComponents::initializePlugins(m_formEditor); QDesignerComponents::createTaskMenu(m_formEditor, this); + m_editWidgetsAction = new QAction(tr("Edit Widgets")); + m_editWidgetsAction->setIcon(QIcon(":/images/images/widgettool.png")); + m_editWidgetsAction->setEnabled(false); + connect(m_editWidgetsAction, SIGNAL(triggered()), this, SLOT(slotEditWidgets())); + connect(m_formEditor->formWindowManager(), SIGNAL(activeFormWindowChanged(QDesignerFormWindowInterface*)), + this, SLOT(slotActiveFormWindowChanged(QDesignerFormWindowInterface*)) ); + + m_modes = new QActionGroup(this); + m_modes->setExclusive(true); + m_modes->addAction(m_editWidgetsAction); + foreach ( QObject* o, QPluginLoader::staticInstances() << m_formEditor->pluginManager()->instances() ) { if ( QDesignerFormEditorPluginInterface* fep = qobject_cast( o ) ) { - // initialize plugin if needed if ( !fep->isInitialized() ) fep->initialize( m_formEditor ); - - // set action chackable -// fep->action()->setCheckable( true ); - -// // add action mode to group -// aModes->addAction( fep->action() ); + fep->action()->setCheckable( true ); + fep->action()->setIcon(QIcon(iconPathByName(fep->action()->objectName()))); + m_modes->addAction(fep->action()); } } - m_widgetBox = QDesignerComponents::createWidgetBox(m_formEditor, 0); m_widgetBox->setWindowTitle(tr("Widget Box")); m_widgetBox->setObjectName(QLatin1String("WidgetBox")); m_formEditor->setWidgetBox(m_widgetBox); m_formEditor->setTopLevel(m_widgetBox); m_designerToolWindows.append(m_widgetBox); - connect(m_widgetBox, SIGNAL(destroyed(QObject*)), this, SLOT(objectDestroyed(QObject*)) ); + connect(m_widgetBox, SIGNAL(destroyed(QObject*)), this, SLOT(slotObjectDestroyed(QObject*)) ); m_objectInspector = QDesignerComponents::createObjectInspector(m_formEditor, 0); m_objectInspector->setWindowTitle(tr("Object Inspector")); m_objectInspector->setObjectName(QLatin1String("ObjectInspector")); m_formEditor->setObjectInspector(m_objectInspector); m_designerToolWindows.append(m_objectInspector); - connect(m_objectInspector, SIGNAL(destroyed(QObject*)), this, SLOT(objectDestroyed(QObject*)) ); + connect(m_objectInspector, SIGNAL(destroyed(QObject*)), this, SLOT(slotObjectDestroyed(QObject*)) ); m_propertyEditor = QDesignerComponents::createPropertyEditor(m_formEditor, 0); m_propertyEditor->setWindowTitle(tr("Property Editor")); m_propertyEditor->setObjectName(QLatin1String("PropertyEditor")); m_formEditor->setPropertyEditor(m_propertyEditor); m_designerToolWindows.append(m_propertyEditor); - connect(m_propertyEditor, SIGNAL(destroyed(QObject*)), this, SLOT(objectDestroyed(QObject*)) ); + connect(m_propertyEditor, SIGNAL(destroyed(QObject*)), this, SLOT(slotObjectDestroyed(QObject*)) ); m_signalSlotEditor = QDesignerComponents::createSignalSlotEditor(m_formEditor, 0); m_signalSlotEditor->setWindowTitle(tr("Signals && Slots Editor")); m_signalSlotEditor->setObjectName(QLatin1String("SignalsAndSlotsEditor")); m_designerToolWindows.append(m_signalSlotEditor); - connect(m_signalSlotEditor, SIGNAL(destroyed(QObject*)), this, SLOT(objectDestroyed(QObject*)) ); + connect(m_signalSlotEditor, SIGNAL(destroyed(QObject*)), this, SLOT(slotObjectDestroyed(QObject*)) ); m_resourcesEditor = QDesignerComponents::createResourceEditor(m_formEditor, 0); m_resourcesEditor->setWindowTitle(tr("Resource Editor")); m_resourcesEditor->setObjectName(QLatin1String("ResourceEditor")); m_designerToolWindows.append(m_resourcesEditor); - connect(m_resourcesEditor, SIGNAL(destroyed(QObject*)), this, SLOT(objectDestroyed(QObject*)) ); + connect(m_resourcesEditor, SIGNAL(destroyed(QObject*)), this, SLOT(slotObjectDestroyed(QObject*)) ); m_actionEditor = QDesignerComponents::createActionEditor(m_formEditor, 0); m_actionEditor->setWindowTitle(tr("Action Editor")); m_actionEditor->setObjectName("ActionEditor"); m_formEditor->setActionEditor(m_actionEditor); m_designerToolWindows.append(m_actionEditor); - connect(m_formEditor, SIGNAL(destroyed(QObject*)), this, SLOT(objectDestroyed(QObject*)) ); + connect(m_formEditor, SIGNAL(destroyed(QObject*)), this, SLOT(slotObjectDestroyed(QObject*)) ); m_designerIntegration = new QDesignerIntegration(m_formEditor,this); m_formEditor->setIntegration(m_designerIntegration); @@ -105,6 +113,28 @@ DialogDesigner::~DialogDesigner() delete m_formEditor; } +void DialogDesigner::initToolBar(QToolBar *tb) +{ + tb->setIconSize(QSize(16,16)); + tb->addAction(m_formEditor->formWindowManager()->actionCopy()); + tb->addAction(m_formEditor->formWindowManager()->actionPaste()); + tb->addAction(m_formEditor->formWindowManager()->actionCut()); + tb->addAction(m_formEditor->formWindowManager()->actionUndo()); + tb->addAction(m_formEditor->formWindowManager()->actionRedo()); + + tb->addActions(m_modes->actions()); + + tb->addAction(m_formEditor->formWindowManager()->actionHorizontalLayout()); + tb->addAction(m_formEditor->formWindowManager()->actionVerticalLayout()); + tb->addAction(m_formEditor->formWindowManager()->actionSplitHorizontal()); + tb->addAction(m_formEditor->formWindowManager()->actionSplitVertical()); + tb->addAction(m_formEditor->formWindowManager()->actionGridLayout()); + m_formEditor->formWindowManager()->actionFormLayout()->setIcon(QIcon(":/images/images/editform.png")); + tb->addAction(m_formEditor->formWindowManager()->actionFormLayout()); + tb->addAction(m_formEditor->formWindowManager()->actionBreakLayout()); + tb->addAction(m_formEditor->formWindowManager()->actionAdjustSize()); +} + QWidget *DialogDesigner::createFormEditor(const QString &content) { QDesignerFormWindowInterface* wnd = m_formEditor->formWindowManager()->createFormWindow(0, Qt::Window); @@ -113,12 +143,22 @@ QWidget *DialogDesigner::createFormEditor(const QString &content) m_formEditor->objectInspector()->setFormWindow(wnd); wnd->editWidgets(); + connect(wnd, SIGNAL(changed()), this, SIGNAL(dialogChanged())); + SharedTools::WidgetHost *placeholder = new SharedTools::WidgetHost(0,wnd); placeholder->setFrameStyle( QFrame::NoFrame | QFrame::Plain ); placeholder->setFocusProxy( wnd ); - return placeholder; + return placeholder; +} +QByteArray DialogDesigner::getDialogDescription(QWidget *form) +{ + SharedTools::WidgetHost* wh = dynamic_cast(form); + if (wh){ + return wh->formWindow()->contents().toUtf8(); + } + return QByteArray(); } void DialogDesigner::setActiveEditor(QWidget *widget) @@ -127,7 +167,6 @@ void DialogDesigner::setActiveEditor(QWidget *widget) if (wh){ m_formEditor->formWindowManager()->setActiveFormWindow(wh->formWindow()); } - } QWidget* DialogDesigner::widgetBox() const @@ -160,7 +199,7 @@ QWidget *DialogDesigner::resourcesEditor() const return m_resourcesEditor; } -void DialogDesigner::objectDestroyed(QObject *object) +void DialogDesigner::slotObjectDestroyed(QObject *object) { for ( int i = 0; iformWindowManager()->formWindowCount(); ++i){ + m_formEditor->formWindowManager()->formWindow(i)->editWidgets(); + } +} + +void DialogDesigner::slotActiveFormWindowChanged(QDesignerFormWindowInterface *formWindow) +{ + if (formWindow){ + m_editWidgetsAction->setEnabled(true); + m_activeWindowName = formWindow->objectName(); + } +} + +QString DialogDesigner::iconPathByName(const QString &name) +{ + if (name.compare("__qt_edit_signals_slots_action") == 0) + return ":/images/images/signalslottool.png"; + if (name.compare("__qt_edit_buddies_action") == 0) + return ":/images/images/buddytool.png"; + if (name.compare("_qt_edit_tab_order_action") == 0) + return ":/images/images/tabordertool.png"; + return ""; +} + } diff --git a/limereport/dialogdesigner/lrdialogdesigner.h b/limereport/dialogdesigner/lrdialogdesigner.h index 2620b71..bebc4dd 100644 --- a/limereport/dialogdesigner/lrdialogdesigner.h +++ b/limereport/dialogdesigner/lrdialogdesigner.h @@ -3,6 +3,7 @@ #include #include +#include class QDesignerFormEditorInterface; class QDesignerFormWindowInterface; @@ -21,7 +22,9 @@ class DialogDesigner : public QObject public: explicit DialogDesigner(QObject *parent = 0); ~DialogDesigner(); + void initToolBar(QToolBar* tb); QWidget* createFormEditor(const QString& content); + QByteArray getDialogDescription(QWidget* form); void setActiveEditor(QWidget* widget); QWidget* widgetBox() const; QWidget* actionEditor() const; @@ -29,8 +32,14 @@ public: QWidget* objectInspector() const; QWidget* signalSlotEditor() const; QWidget* resourcesEditor() const; +signals: + void dialogChanged(); private slots: - void objectDestroyed(QObject* object); + void slotObjectDestroyed(QObject* object); + void slotEditWidgets(); + void slotActiveFormWindowChanged(QDesignerFormWindowInterface *formWindow); +private: + QString iconPathByName(const QString& name); private: QDesignerFormEditorInterface* m_formEditor; QDesignerIntegrationInterface* m_designerIntegration; @@ -41,6 +50,9 @@ private: QWidget* m_signalSlotEditor; QWidget* m_resourcesEditor; QVector m_designerToolWindows; + QAction* m_editWidgetsAction; + QActionGroup* m_modes; + QString m_activeWindowName; }; } // namespace LimeReport diff --git a/limereport/lrreportdesignwidget.cpp b/limereport/lrreportdesignwidget.cpp index 6acb22a..97621ab 100644 --- a/limereport/lrreportdesignwidget.cpp +++ b/limereport/lrreportdesignwidget.cpp @@ -48,7 +48,11 @@ namespace LimeReport { ReportDesignWidget::ReportDesignWidget(ReportEnginePrivate *report, QMainWindow *mainWindow, QWidget *parent) : - QWidget(parent), m_dialogDesigner(new DialogDesigner(this)), m_mainWindow(mainWindow), m_verticalGridStep(10), m_horizontalGridStep(10), m_useGrid(false) + QWidget(parent), +#ifdef HAVE_QTDESIGNER_INTEGRATION + m_dialogDesigner(new DialogDesigner(this)), +#endif + m_mainWindow(mainWindow), m_verticalGridStep(10), m_horizontalGridStep(10), m_useGrid(false) { m_tabWidget = new QTabWidget(this); m_tabWidget->setTabPosition(QTabWidget::South); @@ -74,9 +78,14 @@ ReportDesignWidget::ReportDesignWidget(ReportEnginePrivate *report, QMainWindow m_scriptEditor->setPlainText(report->scriptContext()->initScript()); m_zoomer = new GraphicsViewZoomer(activeView()); + #ifdef Q_OS_WIN m_defaultFont = QFont("Arial",10); #endif + +#ifdef HAVE_QTDESIGNER_INTEGRATION + connect(m_dialogDesigner, SIGNAL(dialogChanged()), this, SLOT(slotDialogChanged())); +#endif } DialogDesigner *ReportDesignWidget::dialogDesigner() const @@ -112,6 +121,20 @@ ReportDesignWidget::EditorTabType ReportDesignWidget::activeTabType() return Page; } +void ReportDesignWidget::initDialogDesignerToolBar(QToolBar *toolBar) +{ + m_dialogDesigner->initToolBar(toolBar); +} + +void ReportDesignWidget::updateDialogs() +{ + for ( int i = 0; icount(); ++i ){ + if (m_tabWidget->tabWhatsThis(i).compare("dialog") == 0){ + m_report->scriptContext()->changeDialog(m_tabWidget->tabText(i), m_dialogDesigner->getDialogDescription(m_tabWidget->widget(i))); + } + } +} + bool ReportDesignWidget::useMagnet() const { return m_useMagnet; @@ -299,7 +322,12 @@ void ReportDesignWidget::slotItemSelected(BaseDesignIntf *item){ } void ReportDesignWidget::saveToFile(const QString &fileName){ + m_report->scriptContext()->setInitScript(m_scriptEditor->toPlainText()); +#ifdef HAVE_QTDESIGNER_INTEGRATION + updateDialogs(); +#endif + if (m_report->saveToFile(fileName)) { m_report->emitSaveFinished(); } @@ -308,6 +336,10 @@ void ReportDesignWidget::saveToFile(const QString &fileName){ bool ReportDesignWidget::save() { m_report->scriptContext()->setInitScript(m_scriptEditor->toPlainText()); +#ifdef HAVE_QTDESIGNER_INTEGRATION + updateDialogs(); +#endif + if (!m_report->reportFileName().isEmpty()){ if (m_report->saveToFile()){ m_report->emitSaveFinished(); @@ -499,12 +531,18 @@ void ReportDesignWidget::setBorders(const BaseDesignIntf::BorderLines& borders) void ReportDesignWidget::previewReport() { report()->scriptContext()->setInitScript(m_scriptEditor->toPlainText()); +#ifdef HAVE_QTDESIGNER_INTEGRATION + updateDialogs(); +#endif report()->previewReport(); } void ReportDesignWidget::printReport() { report()->scriptContext()->setInitScript(m_scriptEditor->toPlainText()); +#ifdef HAVE_QTDESIGNER_INTEGRATION + updateDialogs(); +#endif setCursor(Qt::WaitCursor); report()->printReport(); setCursor(Qt::ArrowCursor); @@ -653,6 +691,14 @@ void ReportDesignWidget::slotCurrentTabChanged(int index) emit activePageChanged(); } +#ifdef HAVE_QTDESIGNER_INTEGRATION + +void ReportDesignWidget::slotDialogChanged() +{ +} + +#endif + bool ReportDesignWidget::eventFilter(QObject *target, QEvent *event) { if (event->type() == QEvent::Wheel){ diff --git a/limereport/lrreportdesignwidget.h b/limereport/lrreportdesignwidget.h index d624617..ee6a157 100644 --- a/limereport/lrreportdesignwidget.h +++ b/limereport/lrreportdesignwidget.h @@ -54,7 +54,6 @@ class ReportDesignWidget : public QWidget { Q_OBJECT Q_PROPERTY(QObject* datasourcesManager READ dataManager()) - friend class ReportDesignWindow; public: enum ToolWindowType{ WidgetBox = 1, @@ -69,6 +68,7 @@ public: Dialog, Script }; + ReportDesignWidget(ReportEnginePrivate* report,QMainWindow *mainWindow,QWidget *parent = 0); ~ReportDesignWidget(); void createStartPage(); void clear(); @@ -103,6 +103,10 @@ public: DialogDesigner *dialogDesigner() const; QWidget* toolWindow(ToolWindowType windowType); EditorTabType activeTabType(); +#ifdef HAVE_QTDESIGNER_INTEGRATION + void initDialogDesignerToolBar(QToolBar* toolBar); + void updateDialogs(); +#endif public slots: void saveToFile(const QString&); bool save(); @@ -135,13 +139,16 @@ public slots: void printReport(); void addPage(); void deleteCurrentPage(); + void slotPagesLoadFinished(); private slots: void slotItemSelected(LimeReport::BaseDesignIntf *item); void slotSelectionChanged(); - void slotPagesLoadFinished(); void slotDatasourceCollectionLoaded(const QString&); void slotSceneRectChanged(QRectF); void slotCurrentTabChanged(int index); +#ifdef HAVE_QTDESIGNER_INTEGRATION + void slotDialogChanged(); +#endif signals: void insertModeStarted(); void itemInserted(LimeReport::PageDesignIntf*,QPointF,const QString&); @@ -164,7 +171,6 @@ protected: void createTabs(); private: bool eventFilter(QObject *target, QEvent *event); - ReportDesignWidget(ReportEnginePrivate* report,QMainWindow *mainWindow,QWidget *parent = 0); private: ReportEnginePrivate* m_report; QGraphicsView *m_view; diff --git a/limereport/lrreportdesignwindow.cpp b/limereport/lrreportdesignwindow.cpp index 8bdb62d..febddfd 100644 --- a/limereport/lrreportdesignwindow.cpp +++ b/limereport/lrreportdesignwindow.cpp @@ -80,6 +80,7 @@ ReportDesignWindow::ReportDesignWindow(ReportEnginePrivate *report, QWidget *par createDialogActionEditor(); createDialogResourceEditor(); createDialogSignalSlotEditor(); + createDialogDesignerToolBar(); #endif m_instance=this; m_statusBar=new QStatusBar(this); @@ -87,11 +88,12 @@ ReportDesignWindow::ReportDesignWindow(ReportEnginePrivate *report, QWidget *par m_statusBar->insertWidget(0,m_lblReportName); setStatusBar(m_statusBar); setWindowTitle("Lime Report Designer"); + showDefaultEditors(); + showDefaultToolBars(); restoreSetting(); m_hideLeftPanel->setChecked(isDockAreaVisible(Qt::LeftDockWidgetArea)); m_hideRightPanel->setChecked(isDockAreaVisible(Qt::RightDockWidgetArea)); m_editorTabType = ReportDesignWidget::Page; - showDefaultEditors(); } ReportDesignWindow::~ReportDesignWindow() @@ -323,6 +325,9 @@ void ReportDesignWindow::createToolBars() addToolBar(m_itemsBordersEditorBar); createReportToolBar(); + + m_pageTools << m_mainToolBar << m_reportToolBar << m_fontEditorBar << m_textAlignmentEditorBar << m_itemsBordersEditorBar; + } void ReportDesignWindow::createItemsActions() @@ -573,6 +578,14 @@ void ReportDesignWindow::createDialogSignalSlotEditor() m_dialogEditors.append(doc); } +void ReportDesignWindow::createDialogDesignerToolBar() +{ + m_dialogDesignerToolBar = addToolBar(tr("Dialog Designer Tools")); + m_dialogDesignerToolBar->setObjectName("DialogDesignerTools"); + m_reportDesignWidget->initDialogDesignerToolBar(m_dialogDesignerToolBar); + m_dialogTools << m_dialogDesignerToolBar; +} + #endif void ReportDesignWindow::createDataWindow() { @@ -622,6 +635,7 @@ void ReportDesignWindow::startNewReport() m_newReportFooter->setEnabled(true); m_editorTabType = ReportDesignWidget::Page; showDefaultEditors(); + showDefaultToolBars(); } void ReportDesignWindow::writePosition() @@ -1048,6 +1062,7 @@ void ReportDesignWindow::slotLoadReport() setWindowTitle(m_reportDesignWidget->report()->reportName() + " - Lime Report Designer"); addRecentFile(fileName); m_editorTabType = ReportDesignWidget::Page; + showDefaultToolBars(); showDefaultEditors(); } } @@ -1215,6 +1230,14 @@ void ReportDesignWindow::updateAvaibleBands(){ } } +void ReportDesignWindow::showDefaultToolBars(){ + foreach (QToolBar* tb, m_pageTools){ + tb->setVisible(m_editorTabType != ReportDesignWidget::Dialog); + } + foreach (QToolBar* tb, m_dialogTools){ + tb->setVisible(m_editorTabType == ReportDesignWidget::Dialog); + } +} void ReportDesignWindow::showDefaultEditors(){ foreach (QDockWidget* w, m_pageEditors) { @@ -1248,12 +1271,14 @@ void ReportDesignWindow::slotActivePageChanged() restoreState(m_dialogEditorsState); else showDefaultEditors(); + showDefaultToolBars(); break; default: if (!m_pageEditors.isEmpty()) restoreState(m_pageEditorsState); else showDefaultEditors(); + showDefaultToolBars(); break; } diff --git a/limereport/lrreportdesignwindow.h b/limereport/lrreportdesignwindow.h index ec37638..0abe16c 100644 --- a/limereport/lrreportdesignwindow.h +++ b/limereport/lrreportdesignwindow.h @@ -144,6 +144,7 @@ private: void createDialogActionEditor(); void createDialogResourceEditor(); void createDialogSignalSlotEditor(); + void createDialogDesignerToolBar(); #endif void updateRedoUndo(); void updateAvaibleBands(); @@ -154,6 +155,7 @@ private: void removeNotExistedRecentFiles(); void removeNotExistedRecentFilesFromMenu(const QString& fileName); void addRecentFile(const QString& fileName); + void showDefaultToolBars(); void showDefaultEditors(); private: static ReportDesignWindow* m_instance; @@ -162,6 +164,9 @@ private: QToolBar* m_fontToolBar; QToolBar* m_reportToolBar; QToolBar* m_alignToolBar; +#ifdef HAVE_QTDESIGNER_INTEGRATION + QToolBar* m_dialogDesignerToolBar; +#endif QToolButton* m_newBandButton; QMenuBar* m_mainMenu; QMenu* m_fileMenu; @@ -249,6 +254,8 @@ private: ReportDesignWidget::EditorTabType m_editorTabType; QByteArray m_pageEditorsState; QByteArray m_dialogEditorsState; + QVector m_pageTools; + QVector m_dialogTools; }; diff --git a/limereport/lrscriptenginemanager.cpp b/limereport/lrscriptenginemanager.cpp index 613b4dc..b57ea88 100644 --- a/limereport/lrscriptenginemanager.cpp +++ b/limereport/lrscriptenginemanager.cpp @@ -1067,6 +1067,17 @@ void ScriptEngineContext::addDialog(const QString& name, const QByteArray& descr m_dialogs.push_back(DialogDescriber::create(name,description)); } +bool ScriptEngineContext::changeDialog(const QString& name, const QByteArray& description) +{ + foreach( DialogDescriber::Ptr describer, m_dialogs){ + if (describer->name().compare(name) == 0){ + describer->setDescription(description); + return true; + } + } + return false; +} + bool ScriptEngineContext::previewDialog(const QString& dialogName) { QDialog* dialog = getDialog(dialogName); diff --git a/limereport/lrscriptenginemanager.h b/limereport/lrscriptenginemanager.h index 36ecda2..af97b63 100644 --- a/limereport/lrscriptenginemanager.h +++ b/limereport/lrscriptenginemanager.h @@ -144,7 +144,8 @@ public: #endif explicit ScriptEngineContext(QObject* parent=0):QObject(parent){} #ifdef HAVE_UI_LOADER - void addDialog(const QString& name, const QByteArray &description); + void addDialog(const QString& name, const QByteArray& description); + bool changeDialog(const QString& name, const QByteArray &description); bool previewDialog(const QString& dialogName); bool containsDialog(const QString& dialogName); const QVector& dialogDescribers(){return m_dialogs;}