mirror of
https://github.com/fwbuilder/fwbuilder
synced 2026-09-13 00:19:55 +02:00
fixes #499
2009-10-07 vadim <vadim@vk.crocodile.org> * FindWhereUsedWidget.cpp (FindWhereUsedWidget::itemClicked): "find where used" panel selects object in the tree or in rules on single click in the list of the results. To open the object in the editor user needs to switch to the editor tab in the bottom docked panel.
This commit is contained in:
@@ -1,3 +1,11 @@
|
||||
2009-10-07 vadim <vadim@vk.crocodile.org>
|
||||
|
||||
* FindWhereUsedWidget.cpp (FindWhereUsedWidget::itemClicked):
|
||||
"find where used" panel selects object in the tree or in rules on
|
||||
single click in the list of the results. To open the object in the
|
||||
editor user needs to switch to the editor tab in the bottom docked
|
||||
panel.
|
||||
|
||||
2009-10-03 vadim <vadim@vk.crocodile.org>
|
||||
|
||||
* PolicyCompiler_ipt.cpp (PolicyCompiler_ipt::insertFailoverRule):
|
||||
|
||||
@@ -2418,6 +2418,22 @@
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>editorPanelTabWidget</sender>
|
||||
<signal>currentChanged(int)</signal>
|
||||
<receiver>FWBMainWindow_q</receiver>
|
||||
<slot>editorPanelTabChanged(int)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>511</x>
|
||||
<y>708</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>540</x>
|
||||
<y>422</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
<slots>
|
||||
<slot>clearRecentFilesMenu()</slot>
|
||||
@@ -2426,5 +2442,6 @@
|
||||
<slot>toggleViewRules()</slot>
|
||||
<slot>toggleViewEditor()</slot>
|
||||
<slot>toggleViewSearch()</slot>
|
||||
<slot>editorPanelTabChanged(int)</slot>
|
||||
</slots>
|
||||
</ui>
|
||||
|
||||
@@ -137,6 +137,8 @@ public slots:
|
||||
void selectActiveSubWindow (/*const QString & text*/);
|
||||
void subWindowActivated(QMdiSubWindow*);
|
||||
|
||||
void editorPanelTabChanged(int);
|
||||
|
||||
void minimize();
|
||||
void maximize();
|
||||
virtual void search();
|
||||
|
||||
@@ -48,17 +48,18 @@
|
||||
using namespace libfwbuilder;
|
||||
|
||||
/*
|
||||
* when ProjectPanel is created, it send bunch of stateChange events
|
||||
* which leads to calls to ProjectPanel::changeEvent() method. This
|
||||
* method checks if editr is visible and contains modified data. Since
|
||||
* we create defaulr ProjectPanel object in the constructor of
|
||||
* when ProjectPanel is created, it sends bunch of stateChange events
|
||||
* which lead to calls to ProjectPanel::changeEvent() method. This
|
||||
* method checks if editor is visible and contains modified data. Since
|
||||
* we create default ProjectPanel object in the constructor of
|
||||
* FWWindow, the first call to ProjectPanel::changeEvent() comes when
|
||||
* object editor has not been create yet. This is why we need to check
|
||||
* for oe != NULL here and below.
|
||||
*/
|
||||
bool FWWindow::isEditorVisible()
|
||||
{
|
||||
return oe != NULL && m_mainWindow->editorDockWidget->isVisible(); // editor
|
||||
return oe != NULL && m_mainWindow->editorDockWidget->isVisible() &&
|
||||
m_mainWindow->editorPanelTabWidget->currentIndex() == EDITOR_PANEL_EDITOR_TAB;
|
||||
}
|
||||
|
||||
bool FWWindow::isEditorModified()
|
||||
@@ -66,6 +67,19 @@ bool FWWindow::isEditorModified()
|
||||
return oe != NULL && oe->isModified();
|
||||
}
|
||||
|
||||
void FWWindow::editorPanelTabChanged(int idx)
|
||||
{
|
||||
if (idx == EDITOR_PANEL_EDITOR_TAB)
|
||||
{
|
||||
ProjectPanel *pp = activeProject();
|
||||
if (pp)
|
||||
{
|
||||
oe->open(pp->getSelectedObject());
|
||||
m_mainWindow->objectEditorStack->setCurrentIndex(oe->getCurrentDialogIndex());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FWWindow::showEditor()
|
||||
{
|
||||
m_mainWindow->objectEditorStack->setCurrentIndex(oe->getCurrentDialogIndex());
|
||||
|
||||
@@ -112,7 +112,31 @@ void FindWhereUsedWidget::setShowObject(bool fl)
|
||||
flShowObject=fl;
|
||||
}
|
||||
|
||||
void FindWhereUsedWidget::itemActivated(QTreeWidgetItem* item)
|
||||
/**
|
||||
* This signal is emitted when the user activates an item by single-
|
||||
* or double-clicking (depending on the platform, i.e. on the
|
||||
* QStyle::SH_ItemView_ActivateItemOnSingleClick style hint) or
|
||||
* pressing a special key (e.g., Enter).
|
||||
*/
|
||||
void FindWhereUsedWidget::itemActivated(QTreeWidgetItem* item, int)
|
||||
{
|
||||
FWObject *container = (FWObject*)(qVariantValue<void*>(item->data(1, Qt::UserRole)));
|
||||
|
||||
if (flShowObject && container!=NULL)
|
||||
{
|
||||
showObject(container);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This signal is emitted when the user clicks inside the widget.
|
||||
*
|
||||
* The specified item is the item that was clicked, or 0 if no item
|
||||
* was clicked. The column is the item's column that was clicked. If
|
||||
* no item was clicked, no signal will be emitted.
|
||||
*
|
||||
*/
|
||||
void FindWhereUsedWidget::itemClicked(QTreeWidgetItem* item, int)
|
||||
{
|
||||
FWObject *container = (FWObject*)(qVariantValue<void*>(item->data(1, Qt::UserRole)));
|
||||
|
||||
|
||||
@@ -85,7 +85,8 @@ public slots:
|
||||
virtual void find();
|
||||
virtual void find(libfwbuilder::FWObject *obj);
|
||||
void init();
|
||||
void itemActivated(QTreeWidgetItem*);
|
||||
void itemActivated(QTreeWidgetItem*, int);
|
||||
void itemClicked(QTreeWidgetItem*, int);
|
||||
void findFromDrop();
|
||||
|
||||
signals:
|
||||
|
||||
+15
-19
@@ -275,8 +275,14 @@ QString ObjectEditor::getOptDialogName(OptType t)
|
||||
return QString("OptionDialog_%1").arg(t);
|
||||
}
|
||||
|
||||
void ObjectEditor::openOpt(FWObject *obj,OptType t)
|
||||
void ObjectEditor::openOpt(FWObject *obj, OptType t)
|
||||
{
|
||||
if (fwbdebug)
|
||||
qDebug() << "ObjectEditor::openOpt obj=" << obj
|
||||
<< QString((obj)?obj->getName().c_str():"")
|
||||
<< QString((obj)?obj->getTypeName().c_str():"")
|
||||
<< "t=" << t;
|
||||
|
||||
if (Rule::cast(obj)==NULL) return;
|
||||
|
||||
disconnectSignals();
|
||||
@@ -332,22 +338,16 @@ void ObjectEditor::open(FWObject *obj)
|
||||
openedOpt = optNone;
|
||||
if (stackIds.count(obj->getTypeName().c_str())!=0)
|
||||
{
|
||||
if (fwbdebug)
|
||||
qDebug() << "ObjectEditor::open obj=" << obj
|
||||
<< QString((obj)?obj->getName().c_str():"")
|
||||
<< QString((obj)?obj->getTypeName().c_str():"");
|
||||
|
||||
disconnectSignals();
|
||||
|
||||
current_dialog_name = obj->getTypeName().c_str();
|
||||
current_dialog_idx = stackIds[current_dialog_name];
|
||||
|
||||
// disconnect( SIGNAL(loadObject_sign(libfwbuilder::FWObject*)) );
|
||||
// disconnect( SIGNAL(validate_sign(bool*)) );
|
||||
// disconnect( SIGNAL(isChanged_sign(bool*)) );
|
||||
// disconnect( SIGNAL(applyChanges_sign()) );
|
||||
// disconnect( SIGNAL(discardChanges_sign()) );
|
||||
// disconnect( SIGNAL(close_sign(QCloseEvent*)) );
|
||||
|
||||
//hide();
|
||||
|
||||
|
||||
|
||||
show();
|
||||
|
||||
connect(this, SIGNAL(loadObject_sign(libfwbuilder::FWObject*)),
|
||||
@@ -358,10 +358,6 @@ void ObjectEditor::open(FWObject *obj)
|
||||
dialogs[ current_dialog_idx ],
|
||||
SLOT(validate(bool*)));
|
||||
|
||||
//connect(this, SIGNAL(isChanged_sign(bool*)),
|
||||
// dialogs[ current_dialog_idx ],
|
||||
// SLOT(isChanged(bool*)));
|
||||
|
||||
connect(this, SIGNAL(applyChanges_sign()),
|
||||
dialogs[ current_dialog_idx ],
|
||||
SLOT(applyChanges()));
|
||||
@@ -388,10 +384,10 @@ void ObjectEditor::open(FWObject *obj)
|
||||
|
||||
emit loadObject_sign(obj);
|
||||
findAndLoadHelp();
|
||||
}
|
||||
|
||||
opened = obj;
|
||||
applyButton->setEnabled(false);
|
||||
opened = obj;
|
||||
applyButton->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void ObjectEditor::disconnectSignals()
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<ui version="4.0" >
|
||||
<class>findWhereUsedWidget_q</class>
|
||||
<widget class="QWidget" name="findWhereUsedWidget_q">
|
||||
<property name="geometry">
|
||||
<widget class="QWidget" name="findWhereUsedWidget_q" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
@@ -10,56 +9,56 @@
|
||||
<height>164</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Preferred" hsizetype="Minimum" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<property name="windowTitle" >
|
||||
<string>Form1</string>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<property name="margin">
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="dropBox">
|
||||
<property name="title">
|
||||
<item row="0" column="0" >
|
||||
<widget class="QGroupBox" name="dropBox" >
|
||||
<property name="title" >
|
||||
<string>Object:</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout">
|
||||
<property name="margin">
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="FWObjectDropArea" name="dropArea" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<widget class="FWObjectDropArea" native="1" name="dropArea" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<property name="font" >
|
||||
<font/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>31</height>
|
||||
@@ -70,38 +69,38 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QGroupBox" name="groupBox4">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
|
||||
<item row="0" column="1" >
|
||||
<widget class="QGroupBox" name="groupBox4" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Expanding" hsizetype="MinimumExpanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<property name="title" >
|
||||
<string>Object is found in :</string>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<property name="margin">
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QTreeWidget" name="resListView">
|
||||
<property name="allColumnsShowFocus">
|
||||
<item row="0" column="0" >
|
||||
<widget class="QTreeWidget" name="resListView" >
|
||||
<property name="allColumnsShowFocus" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<column>
|
||||
<property name="text">
|
||||
<property name="text" >
|
||||
<string>Object</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<property name="text" >
|
||||
<string>Parent</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<property name="text" >
|
||||
<string>Details</string>
|
||||
</property>
|
||||
</column>
|
||||
@@ -110,27 +109,27 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QFrame" name="buttonsBox">
|
||||
<property name="frameShape">
|
||||
<item row="0" column="2" >
|
||||
<widget class="QFrame" name="buttonsBox" >
|
||||
<property name="frameShape" >
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<property name="frameShadow" >
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<property name="margin">
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<item row="0" column="0" >
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
@@ -138,9 +137,9 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="pushButton2">
|
||||
<property name="text">
|
||||
<item row="1" column="0" >
|
||||
<widget class="QPushButton" name="pushButton2" >
|
||||
<property name="text" >
|
||||
<string>Find</string>
|
||||
</property>
|
||||
</widget>
|
||||
@@ -150,7 +149,7 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<layoutdefault spacing="6" margin="11" />
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>FWObjectDropArea</class>
|
||||
@@ -166,36 +165,40 @@
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>resListView</sender>
|
||||
<signal>itemActivated(QTreeWidgetItem*, int)</signal>
|
||||
<sender>pushButton2</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>findWhereUsedWidget_q</receiver>
|
||||
<slot>itemActivated(QTreeWidgetItem*)</slot>
|
||||
<slot>find()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<hint type="sourcelabel" >
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<hint type="destinationlabel" >
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>pushButton2</sender>
|
||||
<signal>clicked()</signal>
|
||||
<sender>resListView</sender>
|
||||
<signal>itemClicked(QTreeWidgetItem*,int)</signal>
|
||||
<receiver>findWhereUsedWidget_q</receiver>
|
||||
<slot>find()</slot>
|
||||
<slot>itemClicked(QTreeWidgetItem*,int)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
<hint type="sourcelabel" >
|
||||
<x>457</x>
|
||||
<y>88</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
<hint type="destinationlabel" >
|
||||
<x>433</x>
|
||||
<y>81</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
<slots>
|
||||
<slot>itemActivated(QTreeWidgetItem*,int)</slot>
|
||||
<slot>itemClicked(QTreeWidgetItem*,int)</slot>
|
||||
</slots>
|
||||
</ui>
|
||||
|
||||
Reference in New Issue
Block a user