Commit 864e68a3 authored by schurade's avatar schurade

[ADD] first commit for work on the GUI

parent f04bf412
......@@ -23,4 +23,6 @@ syntax: glob
syntax: regexp
^Debug$
syntax: glob
.settings
\ No newline at end of file
.settings
syntax: glob
Release
\ No newline at end of file
......@@ -39,15 +39,6 @@ public:
* Default destructor.
*/
virtual ~WGUI();
/**
* \brief
* enable/disable the access to the GUI
* \post
* GUI enabled/disabled
* \param enable true iff gui should be enabled
*/
virtual void setEnabled( bool enable ) = 0;
};
/**
......
......@@ -28,7 +28,6 @@
/**
* This file is provided to allow to get access to all used icons by one include.
*/
#include "logoIcon.xpm"
#include "disc.xpm"
#include "fileopen.xpm"
#include "quit.xpm"
......
......@@ -28,13 +28,19 @@
#include <QtGui/QDockWidget>
#include <QtGui/QFileDialog>
#include <QtGui/QSlider>
#include <QtGui/QVBoxLayout>
#include "WMainWindow.h"
#include "WQtGLWidget.h"
#include "WQtRibbonMenu.h"
#include "WQtPipelineBrowser.h"
#include "WQtDatasetBrowser.h"
#include "../../kernel/WKernel.h"
#include "../icons/WIcons.h"
#include "../icons/logoIcon.xpm"
WMainWindow::~WMainWindow()
{
......@@ -42,149 +48,85 @@ WMainWindow::~WMainWindow()
m_glWidgets.clear();
}
void WMainWindow::addDockableGLWidget( QMainWindow *MainWindow )
{
QDockWidget *dockWidget = new QDockWidget( "Graphics Display" );
dockWidget->setAllowedAreas( Qt::LeftDockWidgetArea
| Qt::RightDockWidgetArea );
boost::shared_ptr<WQtGLWidget> widget = boost::shared_ptr<WQtGLWidget>( new WQtGLWidget( dockWidget ) );
// TODO(all): add some way to remove QtGLWidgets on destruction to delete QtGLWidget
m_glWidgets.push_back( widget );
dockWidget->setWidget( widget.get() );
MainWindow->addDockWidget( Qt::LeftDockWidgetArea, dockWidget );
}
void WMainWindow::connectSlots( QMainWindow *MainWindow )
{
QObject::connect( m_actionExit, SIGNAL( activated() ), MainWindow, SLOT( close() ) );
QObject::connect( m_actionLoad, SIGNAL( activated() ), this, SLOT( load() ) );
QObject::connect( m_toolBar->getQuitButton(), SIGNAL( pressed() ), MainWindow, SLOT( close() ) );
QObject::connect( m_toolBar->getLoadButton(), SIGNAL( pressed() ), this, SLOT( load() ) );
QMetaObject::connectSlotsByName( MainWindow );
}
void WMainWindow::setupGUI( QMainWindow *MainWindow )
{
QIcon mainWindowIcon;
QIcon quitIcon;
QIcon saveIcon;
QIcon loadIcon;
QIcon aboutIcon;
mainWindowIcon.addPixmap( QPixmap( logoIcon_xpm ) );
quitIcon.addPixmap( QPixmap( quit_xpm ) );
saveIcon.addPixmap( QPixmap( disc_xpm ) );
loadIcon.addPixmap( QPixmap( fileopen_xpm ) );
aboutIcon.addPixmap( QPixmap( logoIcon_xpm ) );
m_mainWindowIcon.addPixmap( QPixmap( logoIcon_xpm ) );
if( MainWindow->objectName().isEmpty() )
{
MainWindow->setObjectName( QString::fromUtf8( "MainWindow" ) );
}
MainWindow->resize( 946, 632 );
MainWindow->setWindowIcon( mainWindowIcon );
m_actionLoad = new QAction( MainWindow );
m_actionLoad->setObjectName( QString::fromUtf8( "actionLoad" ) );
m_actionLoad->setIcon( loadIcon );
m_actionLoad->setText( QApplication::translate( "MainWindow", "Load", 0,
QApplication::UnicodeUTF8 ) );
m_actionLoad->setShortcut( QApplication::translate( "MainWindow", "Ctrl+L",
0, QApplication::UnicodeUTF8 ) );
m_actionSave = new QAction( MainWindow );
m_actionSave->setObjectName( QString::fromUtf8( "actionSave" ) );
m_actionSave->setIcon( saveIcon );
m_actionSave->setText( QApplication::translate( "MainWindow", "Save", 0,
QApplication::UnicodeUTF8 ) );
m_actionPreferences = new QAction( MainWindow );
m_actionPreferences->setObjectName( QString::fromUtf8( "actionPreferences" ) );
m_actionPreferences->setText( QApplication::translate( "MainWindow",
"Preferences", 0, QApplication::UnicodeUTF8 ) );
m_actionExit = new QAction( MainWindow );
m_actionExit->setObjectName( QString::fromUtf8( "actionExit" ) );
m_actionExit->setIcon( quitIcon );
m_actionExit->setText( QApplication::translate( "MainWindow", "E&xit", 0,
QApplication::UnicodeUTF8 ) );
m_actionExit->setShortcut( QApplication::translate( "MainWindow", "Ctrl+Q",
0, QApplication::UnicodeUTF8 ) );
m_actionAbout_OpenWalnut = new QAction( MainWindow );
m_actionAbout_OpenWalnut->setObjectName( QString::fromUtf8(
"actionAbout_OpenWalnut" ) );
m_actionAbout_OpenWalnut->setIcon( aboutIcon );
m_actionAbout_OpenWalnut->setText( QApplication::translate( "MainWindow",
"About OpenWalnut", 0, QApplication::UnicodeUTF8 ) );
MainWindow->setWindowIcon( m_mainWindowIcon );
m_centralwidget = new QWidget( MainWindow );
m_centralwidget->setObjectName( QString::fromUtf8( "centralwidget" ) );
MainWindow->setCentralWidget( m_centralwidget );
m_menubar = new QMenuBar( MainWindow );
m_menubar->setObjectName( QString::fromUtf8( "menubar" ) );
m_menubar->setGeometry( QRect( 0, 0, 946, 24 ) );
m_menuFile = new QMenu( m_menubar );
m_menuFile->setObjectName( QString::fromUtf8( "menuFile" ) );
m_menuHelp = new QMenu( m_menubar );
m_menuHelp->setObjectName( QString::fromUtf8( "menuHelp" ) );
MainWindow->setMenuBar( m_menubar );
m_toolBar = new QToolBar( MainWindow );
m_toolBar->setObjectName( QString::fromUtf8( "toolBar" ) );
m_toolBar->addAction( m_actionSave );
m_toolBar->addAction( m_actionLoad );
m_toolBar->addSeparator();
m_toolBar->addAction( m_actionAbout_OpenWalnut );
m_toolBar = new WQtRibbonMenu( MainWindow );
MainWindow->addToolBar( Qt::TopToolBarArea, m_toolBar );
m_statusBar = new QStatusBar( MainWindow );
m_statusBar->setObjectName( QString::fromUtf8( "statusBar" ) );
m_statusBar->showMessage( "No status message yet." );
MainWindow->setStatusBar( m_statusBar );
m_menubar->addAction( m_menuFile->menuAction() );
m_menubar->addAction( m_menuHelp->menuAction() );
m_menuFile->addAction( m_actionLoad );
m_menuFile->addAction( m_actionSave );
m_menuFile->addSeparator();
m_menuFile->addAction( m_actionPreferences );
m_menuFile->addSeparator();
m_menuFile->addAction( m_actionExit );
m_menuFile->setTitle( QApplication::translate( "MainWindow", "&File", 0,
QApplication::UnicodeUTF8 ) );
m_menuHelp->addAction( m_actionAbout_OpenWalnut );
m_menuHelp->setTitle( QApplication::translate( "MainWindow", "&Help", 0,
QApplication::UnicodeUTF8 ) );
boost::shared_ptr<WQtGLWidget> widget = boost::shared_ptr<WQtGLWidget>( new WQtGLWidget( MainWindow ) );
m_glWidgets.push_back( widget );
MainWindow->setCentralWidget( widget.get() );
// initially 3 views
addDockableGLWidget( MainWindow );
addDockableGLWidget( MainWindow );
addDockableGLWidget( MainWindow );
addNavigationGLWidget( MainWindow, QString( "axial" ) );
addNavigationGLWidget( MainWindow, QString( "coronal" ) );
addNavigationGLWidget( MainWindow, QString( "sagittal" ) );
m_pipelineBrowser = new WQtPipelineBrowser();
MainWindow->addDockWidget( Qt::RightDockWidgetArea, m_pipelineBrowser );
m_datasetBrowser = new WQtDatasetBrowser();
MainWindow->addDockWidget( Qt::RightDockWidgetArea, m_datasetBrowser );
m_datasetBrowser->addSubject( "subject1" );
m_datasetBrowser->addDataset( 0, "mr188_t1" );
m_datasetBrowser->addDataset( 0, "mr188_evec" );
MainWindow->setWindowTitle( QApplication::translate( "MainWindow",
"OpenWalnut", 0, QApplication::UnicodeUTF8 ) );
m_toolBar->setWindowTitle( QApplication::translate( "MainWindow",
"toolBar", 0, QApplication::UnicodeUTF8 ) );
connectSlots( MainWindow );
}
void WMainWindow::setEnabled( bool /* enable */ )
QSlider* WMainWindow::addNavigationGLWidget( QMainWindow *MainWindow, QString title )
{
// TODO(wiebel): implement here
QDockWidget *dockWidget = new QDockWidget( title );
dockWidget->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea );
dockWidget->setFeatures( QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable );
QSlider *slider = new QSlider( Qt::Horizontal );
QWidget* panel = new QWidget( dockWidget );
QVBoxLayout* layout = new QVBoxLayout();
boost::shared_ptr<WQtGLWidget> widget = boost::shared_ptr<WQtGLWidget>( new WQtGLWidget( panel ) );
// TODO(all): add some way to remove QtGLWidgets on destruction to delete QtGLWidget
m_glWidgets.push_back( widget );
layout->addWidget( widget.get() );
layout->addWidget( slider );
panel->setLayout( layout );
dockWidget->setWidget( panel );
MainWindow->addDockWidget( Qt::LeftDockWidgetArea, dockWidget );
return slider;
}
void WMainWindow::load()
{
std::cout << "test output: load function" << std::endl;
......@@ -214,3 +156,9 @@ void WMainWindow::load()
WKernel::getRunningKernel()->doLoadDataSets( stdFileNames );
}
WQtDatasetBrowser* WMainWindow::getDatasetBrowser()
{
return m_datasetBrowser;
}
......@@ -36,6 +36,8 @@
#include <QtGui/QMainWindow>
#include <QtGui/QMenu>
#include <QtGui/QMenuBar>
#include <QtGui/QSlider>
#include <QtGui/QStatusBar>
#include <QtGui/QToolBar>
#include <QtGui/QWidget>
......@@ -44,7 +46,8 @@
// forward declarations
class WQtGLWidget;
class WQtPipelineBrowser;
class WQtDatasetBrowser;
class WQtRibbonMenu;
/**
* This class contains the main window and the layout
......@@ -63,44 +66,35 @@ public:
void setupGUI( QMainWindow *MainWindow );
/**
* \brief
* enable/disable the access to the GUI
* \post
* GUI enabled/disabeld
* \param enable true iff gui should be enabled
*/
void setEnabled( bool enable );
/**
* Destructor.
*/
virtual ~WMainWindow();
/**
*
*/
WQtDatasetBrowser* getDatasetBrowser();
private:
/**
* Helper routine for adding new docks with GL content
*/
void addDockableGLWidget( QMainWindow *MainWindow );
QSlider* addNavigationGLWidget( QMainWindow *MainWindow, QString title );
/**
* Connects some signals with some slots
*/
void connectSlots( QMainWindow *MainWindow );
QAction* m_actionLoad;
QAction* m_actionSave;
QAction* m_actionPreferences;
QAction* m_actionExit;
QAction* m_actionAbout_OpenWalnut;
QIcon m_mainWindowIcon;
QWidget* m_centralwidget;
QMenuBar* m_menubar;
QMenu* m_menuFile;
QMenu* m_menuHelp;
QStatusBar* m_statusBar;
QToolBar* m_toolBar;
WQtRibbonMenu* m_toolBar;
std::list<boost::shared_ptr<WQtGLWidget> > m_glWidgets;
WQtPipelineBrowser* m_pipelineBrowser;
WQtDatasetBrowser* m_datasetBrowser;
private slots:
......
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#include <string>
#include "WQtDatasetBrowser.h"
WQtDatasetBrowser::WQtDatasetBrowser( QWidget* parent )
: QDockWidget( parent )
{
m_panel = new QWidget( this );
m_treeWidget = new QTreeWidget( m_panel );
m_treeWidget->setHeaderLabel( QString( "Dataset Browser" ) );
m_tabWidget = new QTabWidget( m_panel );
m_tab1 = new QWidget();
m_tab2 = new QWidget();
m_tab3 = new QWidget();
m_tabWidget->addTab( m_tab1, QString( "tab1" ) );
m_tabWidget->addTab( m_tab2, QString( "tab2" ) );
m_tabWidget->addTab( m_tab3, QString( "tab3" ) );
m_layout = new QVBoxLayout();
m_layout->addWidget( m_treeWidget );
m_layout->addWidget( m_tabWidget );
m_panel->setLayout( m_layout );
this->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea );
this->setFeatures( QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable );
this->setWidget( m_panel );
}
WQtDatasetBrowser::~WQtDatasetBrowser()
{
}
WQtSubjectTreeItem* WQtDatasetBrowser::addSubject( std::string name )
{
WQtSubjectTreeItem* subject = new WQtSubjectTreeItem( m_treeWidget );
subject->setText( 0, QString( name.c_str() ) );
return subject;
}
WQtDatasetTreeItem* WQtDatasetBrowser::addDataset( int subjectId, std::string name )
{
WQtSubjectTreeItem* subject = ( WQtSubjectTreeItem* )m_treeWidget->topLevelItem( subjectId );
return subject->addDatasetItem( name );
}
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#ifndef WQTDATASETBROWSER_H
#define WQTDATASETBROWSER_H
#include <string>
#include <QtGui/QDockWidget>
#include <QtGui/QTabWidget>
#include <QtGui/QTreeWidget>
#include <QtGui/QVBoxLayout>
#include <QtGui/QWidget>
#include "WQtSubjectTreeItem.h"
/**
* TODO(schurade): Document this!
*/
class WQtDatasetBrowser : public QDockWidget
{
public:
/**
* Default constructor.
*
* \param parent Parent widget.
*
* \return
*/
explicit WQtDatasetBrowser( QWidget* parent = 0 );
/**
* Destructor.
*/
virtual ~WQtDatasetBrowser();
/**
*
*/
WQtSubjectTreeItem* addSubject( std::string name );
/**
*
*/
WQtDatasetTreeItem* addDataset( int subjectId, std::string name );
protected:
private:
QTreeWidget* m_treeWidget;
QTabWidget* m_tabWidget;
QWidget* m_tab1;
QWidget* m_tab2;
QWidget* m_tab3;
QWidget* m_panel;
QVBoxLayout* m_layout;
};
#endif // WQTDATASETBROWSER_H
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#include "WQtDatasetTreeItem.h"
WQtDatasetTreeItem::WQtDatasetTreeItem( QTreeWidgetItem * parent )
: QTreeWidgetItem( parent )
{
}
WQtDatasetTreeItem::~WQtDatasetTreeItem()
{
}
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#ifndef WQTDATASETTREEITEM_H
#define WQTDATASETTREEITEM_H
#include <QtGui/QTreeWidgetItem>
/**
* TODO(schurade): Document this!
*/
class WQtDatasetTreeItem : public QTreeWidgetItem
{
public:
explicit WQtDatasetTreeItem( QTreeWidgetItem * parent );
virtual ~WQtDatasetTreeItem();
protected:
private:
};
#endif // WQTDATASETTREEITEM_H
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#include <QtGui/QPushButton>
#include <QtGui/QTabWidget>
#include <QtGui/QHBoxLayout>
#include "WQtRibbonMenu.h"
#include "../icons/WIcons.h"
WQtRibbonMenu::WQtRibbonMenu( QWidget* parent )
: QToolBar( parent )
{
setup();
}
WQtRibbonMenu::~WQtRibbonMenu()
{
}
void WQtRibbonMenu::setup()
{
m_quitIcon.addPixmap( QPixmap( quit_xpm ) );
m_saveIcon.addPixmap( QPixmap( disc_xpm ) );
m_loadIcon.addPixmap( QPixmap( fileopen_xpm ) );
QWidget* filePage = new QWidget();