Signals renaming fixed

This commit is contained in:
Arin Alexander 2018-05-31 18:49:57 +03:00
parent 8d8bea869e
commit 353712864a
7 changed files with 41 additions and 40 deletions

View File

@ -125,6 +125,7 @@ signals:
void saveFinished(); void saveFinished();
void loadFinished(); void loadFinished();
void printedToPDF(QString fileName); void printedToPDF(QString fileName);
void getAviableLanguages(QList<QLocale::Language>* languages); void getAviableLanguages(QList<QLocale::Language>* languages);
void currentDefaulLanguageChanged(QLocale::Language); void currentDefaulLanguageChanged(QLocale::Language);
QLocale::Language getCurrentDefaultLanguage(); QLocale::Language getCurrentDefaultLanguage();

View File

@ -798,7 +798,7 @@ void ReportDesignWidget::slotPagesLoadFinished()
{ {
applySettings(); applySettings();
//setActivePage(m_report->pageAt(0)); //setActivePage(m_report->pageAt(0));
emit loaded(); emit loadFinished();
} }
void ReportDesignWidget::slotDialogDeleted(QString dialogName) void ReportDesignWidget::slotDialogDeleted(QString dialogName)
@ -856,7 +856,7 @@ void ReportDesignWidget::slotReportLoaded()
createTabs(); createTabs();
m_scriptEditor->setPlainText(m_report->scriptContext()->initScript()); m_scriptEditor->setPlainText(m_report->scriptContext()->initScript());
m_scriptEditor->restoreState(editorState); m_scriptEditor->restoreState(editorState);
emit loaded(); emit loadFinished();
m_dialogChanged = false; m_dialogChanged = false;
} }

View File

@ -186,7 +186,7 @@ signals:
void multiItemSelected(); void multiItemSelected();
void commandHistoryChanged(); void commandHistoryChanged();
void cleared(); void cleared();
void loaded(); void loadFinished();
void activePageChanged(); void activePageChanged();
void activePageUpdated(LimeReport::PageDesignIntf*); void activePageUpdated(LimeReport::PageDesignIntf*);
void bandAdded(LimeReport::PageDesignIntf*, LimeReport::BandDesignIntf*); void bandAdded(LimeReport::PageDesignIntf*, LimeReport::BandDesignIntf*);

View File

@ -35,7 +35,7 @@
namespace LimeReport{ namespace LimeReport{
ObjectBrowser::ObjectBrowser(QWidget *parent) ObjectBrowser::ObjectBrowser(QWidget *parent)
:QWidget(parent), m_report(NULL), m_mainWindow(NULL), :QWidget(parent), m_designerWidget(NULL), m_mainWindow(NULL),
m_changingItemSelection(false), m_movingItem(false) m_changingItemSelection(false), m_movingItem(false)
{ {
QVBoxLayout *layout = new QVBoxLayout(this); QVBoxLayout *layout = new QVBoxLayout(this);
@ -47,28 +47,28 @@ ObjectBrowser::ObjectBrowser(QWidget *parent)
m_treeView->setSelectionMode(QAbstractItemView::ExtendedSelection); m_treeView->setSelectionMode(QAbstractItemView::ExtendedSelection);
} }
void ObjectBrowser::setReportEditor(ReportDesignWidget *report) void ObjectBrowser::setReportEditor(ReportDesignWidget *designerWidget)
{ {
m_report=report; m_designerWidget=designerWidget;
connect(m_report,SIGNAL(cleared()),this,SLOT(slotClear())); connect(m_designerWidget,SIGNAL(cleared()),this,SLOT(slotClear()));
connect(m_report, SIGNAL(loadFinished()), this, SLOT(slotReportLoaded())); connect(m_designerWidget, SIGNAL(loadFinished()), this, SLOT(slotReportLoaded()));
connect(m_report, SIGNAL(activePageChanged()), this, SLOT(slotActivePageChanged())); connect(m_designerWidget, SIGNAL(activePageChanged()), this, SLOT(slotActivePageChanged()));
connect(m_report,SIGNAL(itemAdded(LimeReport::PageDesignIntf*,LimeReport::BaseDesignIntf*)), connect(m_designerWidget,SIGNAL(itemAdded(LimeReport::PageDesignIntf*,LimeReport::BaseDesignIntf*)),
this, SLOT(slotItemAdded(LimeReport::PageDesignIntf*,LimeReport::BaseDesignIntf*))); this, SLOT(slotItemAdded(LimeReport::PageDesignIntf*,LimeReport::BaseDesignIntf*)));
connect(m_report, SIGNAL(itemDeleted(LimeReport::PageDesignIntf*,LimeReport::BaseDesignIntf*)), connect(m_designerWidget, SIGNAL(itemDeleted(LimeReport::PageDesignIntf*,LimeReport::BaseDesignIntf*)),
this, SLOT(slotItemDeleted(LimeReport::PageDesignIntf*,LimeReport::BaseDesignIntf*))); this, SLOT(slotItemDeleted(LimeReport::PageDesignIntf*,LimeReport::BaseDesignIntf*)));
connect(m_report, SIGNAL(bandAdded(LimeReport::PageDesignIntf*,LimeReport::BandDesignIntf*)), connect(m_designerWidget, SIGNAL(bandAdded(LimeReport::PageDesignIntf*,LimeReport::BandDesignIntf*)),
this, SLOT(slotBandAdded(LimeReport::PageDesignIntf*,LimeReport::BandDesignIntf*))); this, SLOT(slotBandAdded(LimeReport::PageDesignIntf*,LimeReport::BandDesignIntf*)));
connect(m_report, SIGNAL(bandDeleted(LimeReport::PageDesignIntf*,LimeReport::BandDesignIntf*)), connect(m_designerWidget, SIGNAL(bandDeleted(LimeReport::PageDesignIntf*,LimeReport::BandDesignIntf*)),
this, SLOT(slotBandDeleted(LimeReport::PageDesignIntf*,LimeReport::BandDesignIntf*))); this, SLOT(slotBandDeleted(LimeReport::PageDesignIntf*,LimeReport::BandDesignIntf*)));
connect(m_treeView, SIGNAL(itemSelectionChanged()), connect(m_treeView, SIGNAL(itemSelectionChanged()),
this, SLOT(slotObjectTreeItemSelectionChanged()) ); this, SLOT(slotObjectTreeItemSelectionChanged()) );
connect(m_report, SIGNAL(itemSelected(LimeReport::BaseDesignIntf*)), connect(m_designerWidget, SIGNAL(itemSelected(LimeReport::BaseDesignIntf*)),
this, SLOT(slotItemSelected(LimeReport::BaseDesignIntf*))); this, SLOT(slotItemSelected(LimeReport::BaseDesignIntf*)));
connect(m_report, SIGNAL(multiItemSelected()), connect(m_designerWidget, SIGNAL(multiItemSelected()),
this, SLOT(slotMultiItemSelected()) ); this, SLOT(slotMultiItemSelected()) );
connect(m_report, SIGNAL(activePageUpdated(LimeReport::PageDesignIntf*)), connect(m_designerWidget, SIGNAL(activePageUpdated(LimeReport::PageDesignIntf*)),
this, SLOT(slotActivePageUpdated(LimeReport::PageDesignIntf*))); this, SLOT(slotActivePageUpdated(LimeReport::PageDesignIntf*)));
connect(m_treeView, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), connect(m_treeView, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)),
this, SLOT(slotItemDoubleClicked(QTreeWidgetItem*,int))); this, SLOT(slotItemDoubleClicked(QTreeWidgetItem*,int)));
@ -113,15 +113,15 @@ void ObjectBrowser::buildTree(BaseDesignIntf* ignoredItem){
m_treeView->clear(); m_treeView->clear();
m_itemsMap.clear(); m_itemsMap.clear();
if (!m_report->activePage()) return; if (!m_designerWidget->activePage()) return;
ObjectBrowserNode *topLevelItem=new ObjectBrowserNode(m_treeView); ObjectBrowserNode *topLevelItem=new ObjectBrowserNode(m_treeView);
topLevelItem->setText(0,m_report->activePage()->objectName()); topLevelItem->setText(0,m_designerWidget->activePage()->objectName());
topLevelItem->setObject(m_report->activePage()); topLevelItem->setObject(m_designerWidget->activePage());
m_itemsMap.insert(m_report->activePage(),topLevelItem); m_itemsMap.insert(m_designerWidget->activePage(),topLevelItem);
m_treeView->addTopLevelItem(topLevelItem); m_treeView->addTopLevelItem(topLevelItem);
QList<QGraphicsItem*> itemsList = m_report->activePage()->items(); QList<QGraphicsItem*> itemsList = m_designerWidget->activePage()->items();
foreach (QGraphicsItem* item, itemsList) { foreach (QGraphicsItem* item, itemsList) {
if (item != ignoredItem){ if (item != ignoredItem){
BaseDesignIntf* reportItem = dynamic_cast<BaseDesignIntf*>(item); BaseDesignIntf* reportItem = dynamic_cast<BaseDesignIntf*>(item);
@ -212,20 +212,20 @@ void ObjectBrowser::slotItemDeleted(PageDesignIntf *, BaseDesignIntf *item)
void ObjectBrowser::slotObjectTreeItemSelectionChanged() void ObjectBrowser::slotObjectTreeItemSelectionChanged()
{ {
if (!m_changingItemSelection && m_report->activePage()){ if (!m_changingItemSelection && m_designerWidget->activePage()){
m_changingItemSelection = true; m_changingItemSelection = true;
m_report->activePage()->clearSelection(); m_designerWidget->activePage()->clearSelection();
foreach(QTreeWidgetItem* item, m_treeView->selectedItems()){ foreach(QTreeWidgetItem* item, m_treeView->selectedItems()){
ObjectBrowserNode* tn = dynamic_cast<ObjectBrowserNode*>(item); ObjectBrowserNode* tn = dynamic_cast<ObjectBrowserNode*>(item);
if (tn){ if (tn){
BaseDesignIntf* si = dynamic_cast<BaseDesignIntf*>(tn->object()); BaseDesignIntf* si = dynamic_cast<BaseDesignIntf*>(tn->object());
if (si) { if (si) {
m_report->activePage()->animateItem(si); m_designerWidget->activePage()->animateItem(si);
si->setSelected(true); si->setSelected(true);
QPointF p = si->mapToScene(si->pos()); QPointF p = si->mapToScene(si->pos());
if (si->parentItem()) if (si->parentItem())
p = si->parentItem()->mapToScene(si->pos()); p = si->parentItem()->mapToScene(si->pos());
m_report->activeView()->centerOn(p); m_designerWidget->activeView()->centerOn(p);
} }
} }
} }
@ -256,7 +256,7 @@ void ObjectBrowser::slotMultiItemSelected()
m_treeView->selectionModel()->clear(); m_treeView->selectionModel()->clear();
foreach(QGraphicsItem* item, m_report->activePage()->selectedItems()){ foreach(QGraphicsItem* item, m_designerWidget->activePage()->selectedItems()){
BaseDesignIntf* bg = dynamic_cast<BaseDesignIntf*>(item); BaseDesignIntf* bg = dynamic_cast<BaseDesignIntf*>(item);
if (bg){ if (bg){
ObjectBrowserNode* node = m_itemsMap.value(bg); ObjectBrowserNode* node = m_itemsMap.value(bg);

View File

@ -53,7 +53,7 @@ class ObjectBrowser :public QWidget
Q_OBJECT Q_OBJECT
public: public:
ObjectBrowser(QWidget *parent=0); ObjectBrowser(QWidget *parent=0);
void setReportEditor(LimeReport::ReportDesignWidget* report); void setReportEditor(LimeReport::ReportDesignWidget* designerWidget);
void setMainWindow(QMainWindow* mainWindow); void setMainWindow(QMainWindow* mainWindow);
protected: protected:
void fillNode(QTreeWidgetItem *parentNode, BaseDesignIntf *reportItem, BaseDesignIntf* ignoredItem = 0); void fillNode(QTreeWidgetItem *parentNode, BaseDesignIntf *reportItem, BaseDesignIntf* ignoredItem = 0);
@ -78,7 +78,7 @@ private slots:
void slotActivePageUpdated(LimeReport::PageDesignIntf*); void slotActivePageUpdated(LimeReport::PageDesignIntf*);
void slotItemParentChanged(BaseDesignIntf* item, BaseDesignIntf* parent); void slotItemParentChanged(BaseDesignIntf* item, BaseDesignIntf* parent);
private: private:
ReportDesignWidget* m_report; ReportDesignWidget* m_designerWidget;
QMainWindow* m_mainWindow; QMainWindow* m_mainWindow;
QTreeWidget* m_treeView; QTreeWidget* m_treeView;
QMap<QObject*, ObjectBrowserNode*> m_itemsMap; QMap<QObject*, ObjectBrowserNode*> m_itemsMap;

View File

@ -54,13 +54,13 @@ ScriptBrowser::~ScriptBrowser()
delete ui; delete ui;
} }
void ScriptBrowser::setReportEditor(ReportDesignWidget* report) void ScriptBrowser::setReportEditor(ReportDesignWidget* designerWidget)
{ {
m_report=report; m_designerWidget=designerWidget;
connect(m_report,SIGNAL(cleared()),this,SLOT(slotClear())); connect(m_designerWidget,SIGNAL(cleared()),this,SLOT(slotClear()));
connect(m_report,SIGNAL(loaded()),this,SLOT(slotUpdate())); connect(m_designerWidget,SIGNAL(loadFinished()),this,SLOT(slotUpdate()));
#ifdef HAVE_UI_LOADER #ifdef HAVE_UI_LOADER
connect(m_report->scriptContext(), SIGNAL(dialogAdded(QString)), this, SLOT(slotDialogAdded(QString))); connect(m_designerWidget->scriptContext(), SIGNAL(dialogAdded(QString)), this, SLOT(slotDialogAdded(QString)));
#endif #endif
updateFunctionTree(); updateFunctionTree();
} }
@ -163,9 +163,9 @@ void ScriptBrowser::on_tbAddDialog_clicked()
QWidget* widget = loader.load(&file); QWidget* widget = loader.load(&file);
QDialog* dialog = dynamic_cast<QDialog*>(widget); QDialog* dialog = dynamic_cast<QDialog*>(widget);
if (dialog){ if (dialog){
if (!m_report->scriptContext()->containsDialog(dialog->objectName())){ if (!m_designerWidget->scriptContext()->containsDialog(dialog->objectName())){
file.seek(0); file.seek(0);
m_report->scriptContext()->addDialog(dialog->objectName(),file.readAll()); m_designerWidget->scriptContext()->addDialog(dialog->objectName(),file.readAll());
//updateDialogsTree(); //updateDialogsTree();
} else { } else {
QMessageBox::critical(this,tr("Error"),tr("Dialog with name: %1 already exists").arg(dialog->objectName())); QMessageBox::critical(this,tr("Error"),tr("Dialog with name: %1 already exists").arg(dialog->objectName()));
@ -186,14 +186,14 @@ void ScriptBrowser::on_tbAddDialog_clicked()
void ScriptBrowser::on_tbRunDialog_clicked() void ScriptBrowser::on_tbRunDialog_clicked()
{ {
if (ui->twDialogs->currentItem()&& ui->twDialogs->currentItem()->parent()==0){ if (ui->twDialogs->currentItem()&& ui->twDialogs->currentItem()->parent()==0){
m_report->scriptContext()->previewDialog(ui->twDialogs->currentItem()->text(0)); m_designerWidget->scriptContext()->previewDialog(ui->twDialogs->currentItem()->text(0));
} }
} }
void ScriptBrowser::on_tbDeleteDialog_clicked() void ScriptBrowser::on_tbDeleteDialog_clicked()
{ {
if (ui->twDialogs->currentItem()&& ui->twDialogs->currentItem()->parent()==0){ if (ui->twDialogs->currentItem()&& ui->twDialogs->currentItem()->parent()==0){
m_report->scriptContext()->deleteDialog(ui->twDialogs->currentItem()->text(0)); m_designerWidget->scriptContext()->deleteDialog(ui->twDialogs->currentItem()->text(0));
updateDialogsTree(); updateDialogsTree();
} }
} }

View File

@ -48,8 +48,8 @@ class ScriptBrowser : public QWidget
public: public:
explicit ScriptBrowser(QWidget *parent = 0); explicit ScriptBrowser(QWidget *parent = 0);
~ScriptBrowser(); ~ScriptBrowser();
void setReportEditor(LimeReport::ReportDesignWidget* report); void setReportEditor(LimeReport::ReportDesignWidget* designerWidget);
inline ReportDesignWidget* reportEditor(){return m_report;} inline ReportDesignWidget* reportEditor(){return m_designerWidget;}
void updateFunctionTree(); void updateFunctionTree();
#ifdef HAVE_UI_LOADER #ifdef HAVE_UI_LOADER
void updateDialogsTree(); void updateDialogsTree();
@ -71,7 +71,7 @@ private slots:
private: private:
Ui::ScriptBrowser *ui; Ui::ScriptBrowser *ui;
ReportDesignWidget* m_report; ReportDesignWidget* m_designerWidget;
}; };
} // namespace LimeReport } // namespace LimeReport