Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
b1f1c802
Commit
b1f1c802
authored
Dec 07, 2009
by
Sebastian Eichelbaum
Browse files
[CHANGE] - preparations for including dynamic module connection to gui
parent
ea44f149
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
85 additions
and
39 deletions
+85
-39
src/common/WTypeComparable.hpp
src/common/WTypeComparable.hpp
+2
-2
src/gui/qt4/datasetbrowser/WQtDatasetBrowser.cpp
src/gui/qt4/datasetbrowser/WQtDatasetBrowser.cpp
+23
-7
src/gui/qt4/datasetbrowser/WQtDatasetBrowser.h
src/gui/qt4/datasetbrowser/WQtDatasetBrowser.h
+7
-0
src/gui/qt4/guiElements/WQtPushButton.cpp
src/gui/qt4/guiElements/WQtPushButton.cpp
+5
-0
src/gui/qt4/guiElements/WQtPushButton.h
src/gui/qt4/guiElements/WQtPushButton.h
+7
-0
src/gui/qt4/ribbonMenu/WQtMenuPage.cpp
src/gui/qt4/ribbonMenu/WQtMenuPage.cpp
+9
-0
src/gui/qt4/ribbonMenu/WQtMenuPage.h
src/gui/qt4/ribbonMenu/WQtMenuPage.h
+13
-0
src/gui/qt4/ribbonMenu/WQtRibbonMenu.cpp
src/gui/qt4/ribbonMenu/WQtRibbonMenu.cpp
+10
-2
src/gui/qt4/ribbonMenu/WQtRibbonMenu.h
src/gui/qt4/ribbonMenu/WQtRibbonMenu.h
+1
-1
src/kernel/WKernel.cpp
src/kernel/WKernel.cpp
+0
-8
src/kernel/WModuleInputData.hpp
src/kernel/WModuleInputData.hpp
+4
-8
src/kernel/WModuleOutputData.hpp
src/kernel/WModuleOutputData.hpp
+4
-11
No files found.
src/common/WTypeComparable.hpp
View file @
b1f1c802
...
...
@@ -64,13 +64,13 @@ private:
template
<
typename
T
>
WTypeComparable
<
T
>::
WTypeComparable
()
{
// init
}
template
<
typename
T
>
WTypeComparable
<
T
>::~
WTypeComparable
()
{
// clean up
}
#endif // WTYPECOMPARABLE_H
...
...
src/gui/qt4/datasetbrowser/WQtDatasetBrowser.cpp
View file @
b1f1c802
...
...
@@ -126,6 +126,19 @@ WQtModuleTreeItem* WQtDatasetBrowser::addModule( boost::shared_ptr< WModule > mo
return
tiModules
->
addModuleItem
(
module
);
}
boost
::
shared_ptr
<
WModule
>
WQtDatasetBrowser
::
getSelectedModule
()
{
if
(
m_treeWidget
->
selectedItems
().
at
(
0
)
->
type
()
==
1
)
{
return
(
(
WQtDatasetTreeItem
*
)
m_treeWidget
->
selectedItems
().
at
(
0
)
)
->
getModule
();
}
else
if
(
m_treeWidget
->
selectedItems
().
at
(
0
)
->
type
()
==
3
)
{
return
(
(
WQtModuleTreeItem
*
)
m_treeWidget
->
selectedItems
().
at
(
0
)
)
->
getModule
();
}
return
boost
::
shared_ptr
<
WModule
>
();
}
void
WQtDatasetBrowser
::
selectTreeItem
()
{
...
...
@@ -139,22 +152,25 @@ void WQtDatasetBrowser::selectTreeItem()
}
boost
::
shared_ptr
<
WModule
>
module
;
m_mainWindow
->
getToolBar
()
->
clearNonPersistentTabs
();
if
(
m_treeWidget
->
selectedItems
().
at
(
0
)
->
type
()
==
1
)
{
module
=
(
(
WQtDatasetTreeItem
*
)
m_treeWidget
->
selectedItems
().
at
(
0
)
)
->
getModule
();
// create ribbon menu entry
m_mainWindow
->
getToolBar
()
->
addTab
(
QString
(
"Compatibles"
),
false
);
std
::
set
<
boost
::
shared_ptr
<
WModule
>
>
comps
=
WModuleFactory
::
getModuleFactory
()
->
getCompatiblePrototypes
(
module
);
for
(
std
::
set
<
boost
::
shared_ptr
<
WModule
>
>::
iterator
iter
=
comps
.
begin
();
iter
!=
comps
.
end
();
++
iter
)
{
m_mainWindow
->
getToolBar
()
->
addPushButton
(
QString
(
(
*
iter
)
->
getName
().
c_str
()
),
QString
(
"Compatibles"
),
m_mainWindow
->
getIconManager
()
->
getIcon
(
"load"
),
QString
(
(
*
iter
)
->
getName
().
c_str
()
)
);
}
}
else
{
module
=
(
(
WQtModuleTreeItem
*
)
m_treeWidget
->
selectedItems
().
at
(
0
)
)
->
getModule
();
}
// create ribbon menu entry
std
::
set
<
boost
::
shared_ptr
<
WModule
>
>
comps
=
WModuleFactory
::
getModuleFactory
()
->
getCompatiblePrototypes
(
module
);
for
(
std
::
set
<
boost
::
shared_ptr
<
WModule
>
>::
iterator
iter
=
comps
.
begin
();
iter
!=
comps
.
end
();
++
iter
)
{
std
::
cout
<<
"Name:"
<<
(
*
iter
)
->
getName
()
<<
std
::
endl
;
}
// create properties
std
::
vector
<
WProperty
*
>
props
=
module
->
getProperties
()
->
getPropertyVector
();
...
...
src/gui/qt4/datasetbrowser/WQtDatasetBrowser.h
View file @
b1f1c802
...
...
@@ -103,6 +103,13 @@ public:
*/
void
connectSlots
();
/**
* Returns the module currently selected in dataset browser.
*
* \return the module.
*/
boost
::
shared_ptr
<
WModule
>
getSelectedModule
();
public
slots
:
void
slotSetIntProperty
(
QString
name
,
int
value
);
void
slotSetBoolProperty
(
QString
name
,
bool
value
);
...
...
src/gui/qt4/guiElements/WQtPushButton.cpp
View file @
b1f1c802
...
...
@@ -42,6 +42,11 @@ void WQtPushButton::setName( QString name )
m_name
=
name
;
}
QString
WQtPushButton
::
getName
()
{
return
m_name
;
}
void
WQtPushButton
::
emitPressed
()
{
emit
pushButtonPressed
(
m_name
,
true
);
...
...
src/gui/qt4/guiElements/WQtPushButton.h
View file @
b1f1c802
...
...
@@ -52,6 +52,13 @@ public:
*/
void
setName
(
QString
name
);
/**
* Getter for this button's name.
*
* \return the name
*/
QString
getName
();
private:
QString
m_name
;
...
...
src/gui/qt4/ribbonMenu/WQtMenuPage.cpp
View file @
b1f1c802
...
...
@@ -22,6 +22,8 @@
//
//---------------------------------------------------------------------------
#include <vector>
#include "WQtMenuPage.h"
WQtMenuPage
::
WQtMenuPage
(
QString
name
,
bool
persistent
)
...
...
@@ -47,11 +49,18 @@ QString WQtMenuPage::getName()
return
m_name
;
}
std
::
vector
<
QString
>
WQtMenuPage
::
getButtons
()
{
return
m_ownButtons
;
}
void
WQtMenuPage
::
addButton
(
WQtPushButton
*
button
)
{
int
count
=
m_pageLayout
->
count
();
m_pageLayout
->
insertWidget
(
count
-
1
,
button
);
this
->
setLayout
(
m_pageLayout
);
m_ownButtons
.
push_back
(
button
->
getName
()
);
}
bool
WQtMenuPage
::
isPersistent
()
const
...
...
src/gui/qt4/ribbonMenu/WQtMenuPage.h
View file @
b1f1c802
...
...
@@ -25,6 +25,7 @@
#ifndef WQTMENUPAGE_H
#define WQTMENUPAGE_H
#include <vector>
#include <QtGui/QHBoxLayout>
#include <QtGui/QWidget>
...
...
@@ -55,6 +56,13 @@ public:
*/
void
addButton
(
WQtPushButton
*
button
);
/**
* Gives back the list of buttons associated with this tab.
*
* \return the list of buttons
*/
std
::
vector
<
QString
>
getButtons
();
QString
getName
();
/**
...
...
@@ -75,6 +83,11 @@ private:
QHBoxLayout
*
m_pageLayout
;
QString
m_name
;
/**
* List of buttons belonging to this tab.
*/
std
::
vector
<
QString
>
m_ownButtons
;
};
#endif // WQTMENUPAGE_H
src/gui/qt4/ribbonMenu/WQtRibbonMenu.cpp
View file @
b1f1c802
...
...
@@ -24,6 +24,8 @@
#include <cassert>
#include <iostream>
#include <vector>
#include <map>
#include "WQtRibbonMenu.h"
...
...
@@ -42,12 +44,12 @@ WQtRibbonMenu::~WQtRibbonMenu()
}
WQtMenuPage
*
WQtRibbonMenu
::
addTab
(
QString
name
)
WQtMenuPage
*
WQtRibbonMenu
::
addTab
(
QString
name
,
bool
persistent
)
{
// don't add a tab with the same name twice
assert
(
m_tabList
.
count
(
name
)
==
0
);
WQtMenuPage
*
tab
=
new
WQtMenuPage
(
name
);
WQtMenuPage
*
tab
=
new
WQtMenuPage
(
name
,
persistent
);
m_tabWidget
->
addTab
(
tab
,
name
);
...
...
@@ -84,6 +86,12 @@ void WQtRibbonMenu::clearNonPersistentTabs()
int
idx
=
m_tabWidget
->
indexOf
(
(
*
iter
).
second
);
if
(
!
(
*
iter
).
second
->
isPersistent
()
)
{
std
::
vector
<
QString
>
buttons
=
(
*
iter
).
second
->
getButtons
();
for
(
std
::
vector
<
QString
>::
iterator
bIter
=
buttons
.
begin
();
bIter
!=
buttons
.
end
();
++
bIter
)
{
m_buttonList
.
erase
(
*
bIter
);
}
m_tabWidget
->
removeTab
(
idx
);
m_tabList
.
erase
(
iter
);
}
...
...
src/gui/qt4/ribbonMenu/WQtRibbonMenu.h
View file @
b1f1c802
...
...
@@ -51,7 +51,7 @@ public:
/**
*
*/
WQtMenuPage
*
addTab
(
QString
name
);
WQtMenuPage
*
addTab
(
QString
name
,
bool
persistent
=
true
);
/**
*
...
...
src/kernel/WKernel.cpp
View file @
b1f1c802
...
...
@@ -230,14 +230,6 @@ void WKernel::doLoadDataSets( std::vector< std::string > fileNames )
shared_ptr
<
WModule
>
mod
=
m_moduleFactory
->
create
(
m_moduleFactory
->
getPrototypeByName
(
"Data Module"
)
);
mod
->
getProperties
()
->
setValue
(
"filename"
,
(
*
iter
)
);
m_moduleContainer
->
add
(
mod
);
/*std::set< boost::shared_ptr< WModule > > comps = m_moduleFactory->getCompatiblePrototypes( mod );
WLogger::getLogger()->addLogMessage( "Compatible Modules? -> ", "Kernel", LL_ERROR );
for ( std::set< boost::shared_ptr< WModule > >::iterator iter=comps.begin(); iter != comps.end(); ++iter )
{
WLogger::getLogger()->addLogMessage( "Compatible Modules: " + ( *iter )->getName() , "Kernel", LL_ERROR );
}*/
}
}
...
...
src/kernel/WModuleInputData.hpp
View file @
b1f1c802
...
...
@@ -108,14 +108,10 @@ public:
*/
virtual
bool
connectable
(
boost
::
shared_ptr
<
WModuleConnector
>
con
)
{
//if ( dynamic_cast<WModuleOutputData<T>* >( con.get() ) ) // NOLINT - since we really need them here
{
// NOTE: the upper cast already checked the compatibility completely. WModuleInputConnector::connectable does the
// same check again. But since we do not know what checks will be added to WModuleInputConnector::connectable in the
// future we forward the call.
return
WModuleInputConnector
::
connectable
(
con
);
}
return
false
;
// NOTE: the upper cast already checked the compatibility completely. WModuleInputConnector::connectable does the
// same check again. But since we do not know what checks will be added to WModuleInputConnector::connectable in the
// future we forward the call.
return
WModuleInputConnector
::
connectable
(
con
);
};
protected:
...
...
src/kernel/WModuleOutputData.hpp
View file @
b1f1c802
...
...
@@ -98,17 +98,10 @@ public:
*/
virtual
bool
connectable
(
boost
::
shared_ptr
<
WModuleConnector
>
con
)
{
//WLogger::getLogger()->addLogMessage( "MAGUCKN", getCanonicalName(), LL_ERROR );
//WLogger::getLogger()->addLogMessage( "Mit: " + con->getCanonicalName(), getCanonicalName(), LL_ERROR );
//if ( dynamic_cast< WModuleInputData< T >* >( con.get() ) ) // NOLINT - since we really need the dynamic cast here
{
//WLogger::getLogger()->addLogMessage( "GEIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIL" + con->getCanonicalName(), getCanonicalName(), LL_ERROR );
// NOTE: the upper cast already checked the compatibility completely. WModuleOutputConnector::connectable does the
// same check again. But since we do not know what checks will be added to WModuleOutputConnector::connectable in the
// future we forward the call.
return
WModuleOutputConnector
::
connectable
(
con
);
}
// NOTE: the upper cast already checked the compatibility completely. WModuleOutputConnector::connectable does the
// same check again. But since we do not know what checks will be added to WModuleOutputConnector::connectable in the
// future we forward the call.
return
WModuleOutputConnector
::
connectable
(
con
);
};
protected:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment