Commit 9d70e7e8 authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum
Browse files

[CHANGE] - preparations for including dynamic module connection to gui

parent 94c6b55a
......@@ -102,13 +102,14 @@ void WMainWindow::setupGUI( boost::program_options::variables_map guiConfigurati
m_navSagittal->getGLWidget()->setBgColor( bgColor );
}
m_datasetBrowser = new WQtDatasetBrowser();
setupToolBar();
m_toolBar->clearNonPersistentTabs();
m_datasetBrowser = new WQtDatasetBrowser( this );
addDockWidget( Qt::RightDockWidgetArea, m_datasetBrowser );
m_datasetBrowser->addSubject( "subject1" );
connect( m_datasetBrowser, SIGNAL( dataSetBrowserEvent( QString, bool ) ), &m_propertyManager, SLOT( slotBoolChanged( QString, bool ) ) );
setupToolBar();
}
void WMainWindow::setupToolBar()
......
......@@ -38,12 +38,16 @@
#include "WQtCheckBox.h"
#include "WQtModuleHeaderTreeItem.h"
#include "../WMainWindow.h"
#include "../../../modules/data/WMData.h"
WQtDatasetBrowser::WQtDatasetBrowser( QWidget* parent )
WQtDatasetBrowser::WQtDatasetBrowser( WMainWindow* parent )
: QDockWidget( parent )
{
m_mainWindow = parent;
m_panel = new QWidget( this );
m_treeWidget = new WQtTreeWidget( m_panel );
......
......@@ -40,6 +40,8 @@
#include "../../../dataHandler/WDataSet.h"
class WMainWindow;
/**
* container widget for a tree widget with context menu and some control widgets
*/
......@@ -55,7 +57,7 @@ public:
*
* \return
*/
explicit WQtDatasetBrowser( QWidget* parent = 0 );
explicit WQtDatasetBrowser( WMainWindow* parent = 0 );
/**
* Destructor.
......@@ -109,6 +111,10 @@ public slots:
protected:
/**
* Reference to the main window of the application.
*/
WMainWindow* m_mainWindow;
private:
WQtTreeWidget* m_treeWidget;
......
......@@ -24,11 +24,13 @@
#include "WQtMenuPage.h"
WQtMenuPage::WQtMenuPage( QString name )
WQtMenuPage::WQtMenuPage( QString name, bool persistent )
: QWidget()
{
m_name = name;
m_persistent = persistent;
m_pageLayout = new QHBoxLayout();
m_pageLayout->addStretch();
......@@ -51,3 +53,9 @@ void WQtMenuPage::addButton( WQtPushButton* button )
m_pageLayout->insertWidget( count -1, button );
this->setLayout( m_pageLayout );
}
bool WQtMenuPage::isPersistent() const
{
return m_persistent;
}
......@@ -38,9 +38,12 @@ class WQtMenuPage : public QWidget
{
public:
/**
* TODO(schurade): Document this!
* Constructor creates new tab.
*
* \param name name of tab
* \param persistent true if persistent
*/
explicit WQtMenuPage( QString name );
WQtMenuPage( QString name, bool persistent = true );
/**
* TODO(schurade): Document this!
......@@ -54,7 +57,20 @@ public:
QString getName();
/**
* Determines whether this tab is persistent.
*
* \return true if persistent.
*/
bool isPersistent() const;
protected:
/**
* True if the tab should not disappear when treeitem selection event occurs.
*/
bool m_persistent;
private:
QHBoxLayout* m_pageLayout;
......
......@@ -23,6 +23,7 @@
//---------------------------------------------------------------------------
#include <cassert>
#include <iostream>
#include "WQtRibbonMenu.h"
......@@ -75,3 +76,17 @@ WQtPushButton* WQtRibbonMenu::getButton( QString name )
assert( m_buttonList.count( name ) == 1 );
return m_buttonList[name];
}
void WQtRibbonMenu::clearNonPersistentTabs()
{
for ( std::map< QString, WQtMenuPage*>::iterator iter = m_tabList.begin(); iter != m_tabList.end(); ++iter )
{
int idx = m_tabWidget->indexOf( ( *iter ).second );
if ( !( *iter ).second->isPersistent() )
{
m_tabWidget->removeTab( idx );
m_tabList.erase( iter );
}
}
}
......@@ -63,6 +63,10 @@ public:
*/
WQtPushButton* getButton( QString name );
/**
* Removes tabs that are not marked persistent.
*/
void clearNonPersistentTabs();
protected:
private:
std::map< QString, WQtMenuPage*>m_tabList;
......
......@@ -135,8 +135,6 @@ void WKernel::threadMain()
m_moduleContainer->add( m_moduleFactory->create( m_moduleFactory->getPrototypeByName( "Navigation Slice Module" ) ) , true );
m_moduleContainer->add( m_moduleFactory->create( m_moduleFactory->getPrototypeByName( "Coordinate System Module" ) ) , true );
m_moduleContainer->add( m_moduleFactory->create( m_moduleFactory->getPrototypeByName( "HUD" ) ) , true );
m_moduleContainer->add( m_moduleFactory->create( m_moduleFactory->getPrototypeByName( "Fiber Display Module" ) ) , true );
// actually there is nothing more to do here
waitForStop();
......@@ -233,13 +231,13 @@ void WKernel::doLoadDataSets( std::vector< std::string > fileNames )
mod->getProperties()->setValue( "filename" , ( *iter ) );
m_moduleContainer->add( mod );
std::set< boost::shared_ptr< WModule > > comps = m_moduleFactory->getCompatiblePrototypes( 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 );
}
}*/
}
exit(0);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment