Commit 141b7573 authored by schurade's avatar schurade
Browse files

[CHANGE] changed the directory structure of the gui folder, more work on the...

[CHANGE] changed the directory structure of the gui folder, more work on the menu and dynamically adding of buttons
parent b83b8def
......@@ -28,11 +28,14 @@
/**
* 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"
#include "axial.xpm"
#include "cor.xpm"
#include "sag.xpm"
#endif // WICONS_H
......@@ -14,7 +14,7 @@ SET(GUI_QT4_MOC_HDRS
WMainWindow.h
WQtNavGLWidget.h
WPropertyManager.h
WQtPushButton.h
guiElements/WQtPushButton.h
datasetbrowser/WQtCheckBox.h
datasetbrowser/WQtDatasetBrowser.h
datasetbrowser/WQtDSBWidget.h
......@@ -26,7 +26,7 @@ SET(GUI_QT4_MOC_HDRS
QT4_WRAP_CPP(GUI_QT4_MOC_SRCS ${GUI_QT4_MOC_HDRS} )
FILE(GLOB GUI_QT4_SRC "*.[c,h]pp" "datasetbrowser/*cpp" )
FILE(GLOB GUI_QT4_SRC "*.[c,h]pp" "guiElements/*cpp" "datasetbrowser/*cpp" "ribbonMenu/*cpp" )
ADD_LIBRARY( guiqt4 SHARED ${GUI_QT4_SRC} ${GUI_QT4_MOC_SRCS} )
......
......@@ -37,7 +37,7 @@
#include "WQtNavGLWidget.h"
#include "../icons/logoIcon.xpm"
#include "../icons/WIcons.h"
WMainWindow::WMainWindow()
{
......@@ -61,15 +61,12 @@ void WMainWindow::setupGUI( QMainWindow *mainWindow )
}
mainWindow->resize( 946, 632 );
mainWindow->setWindowIcon( m_mainWindowIcon );
mainWindow->setWindowTitle( QApplication::translate( "MainWindow", "OpenWalnut", 0, QApplication::UnicodeUTF8 ) );
m_centralwidget = new QWidget( mainWindow );
m_centralwidget->setObjectName( QString::fromUtf8( "centralwidget" ) );
mainWindow->setCentralWidget( m_centralwidget );
m_toolBar = new WQtRibbonMenu( mainWindow );
mainWindow->addToolBar( Qt::TopToolBarArea, m_toolBar );
std::cout << "init main gl" << std::endl;
boost::shared_ptr<WQtGLWidget> widget = boost::shared_ptr<WQtGLWidget>( new WQtGLWidget( mainWindow ) );
m_glWidgets.push_back( widget );
......@@ -97,19 +94,64 @@ void WMainWindow::setupGUI( QMainWindow *mainWindow )
m_datasetBrowser = new WQtDatasetBrowser();
mainWindow->addDockWidget( Qt::RightDockWidgetArea, m_datasetBrowser );
m_datasetBrowser->addSubject( "subject1" );
mainWindow->setWindowTitle( QApplication::translate( "MainWindow", "OpenWalnut", 0, QApplication::UnicodeUTF8 ) );
connect( m_datasetBrowser, SIGNAL( dataSetBrowserEvent( QString, bool ) ), m_propertyManager, SLOT( slotBoolChanged( QString, bool ) ) );
connect( m_toolBar->getQuitButton(), SIGNAL( pressed() ), mainWindow, SLOT( close() ) );
connect( m_toolBar->getLoadButton(), SIGNAL( pressed() ), this, SLOT( openLoadDialog() ) );
setupToolBar( mainWindow );
}
connect( m_toolBar->getAxiButton(), SIGNAL( pushButtonToggled( QString, bool ) ), m_propertyManager, SLOT( slotBoolChanged( QString, bool ) ) );
connect( m_toolBar->getCorButton(), SIGNAL( pushButtonToggled( QString, bool ) ), m_propertyManager, SLOT( slotBoolChanged( QString, bool ) ) );
connect( m_toolBar->getSagButton(), SIGNAL( pushButtonToggled( QString, bool ) ), m_propertyManager, SLOT( slotBoolChanged( QString, bool ) ) );
void WMainWindow::setupToolBar( QMainWindow *mainWindow )
{
m_toolBar = new WQtRibbonMenu( mainWindow );
connect( m_datasetBrowser, SIGNAL( dataSetBrowserEvent( QString, bool ) ), m_propertyManager, SLOT( slotBoolChanged( QString, bool ) ) );
m_quitIcon.addPixmap( QPixmap( quit_xpm ) );
m_saveIcon.addPixmap( QPixmap( disc_xpm ) );
m_loadIcon.addPixmap( QPixmap( fileopen_xpm ) );
m_toolBar->addTab( QString( "File" ) );
m_toolBar->addPushButton( QString( "buttonLoad" ), QString( "File" ), m_loadIcon, QString( "load" ) );
m_toolBar->addPushButton( QString( "buttonSave" ), QString( "File" ), m_loadIcon, QString( "save" ) );
m_toolBar->addPushButton( QString( "buttonQuit" ), QString( "File" ), m_loadIcon, QString( "exit" ) );
m_toolBar->getButton( QString( "buttonLoad" ) )->setMaximumSize( 50, 24 );
m_toolBar->getButton( QString( "buttonSave" ) )->setMaximumSize( 50, 24 );
m_toolBar->getButton( QString( "buttonQuit" ) )->setMaximumSize( 50, 24 );
connect( m_toolBar->getButton( QString( "buttonQuit" ) ), SIGNAL( pressed() ), mainWindow, SLOT( close() ) );
connect( m_toolBar->getButton( QString( "buttonLoad" ) ), SIGNAL( pressed() ), this, SLOT( openLoadDialog() ) );
m_toolBar->addTab( QString( "Modules" ) );
m_toolBar->addTab( QString( "Help" ) );
m_axiIcon.addPixmap( QPixmap( axial_xpm ) );
m_corIcon.addPixmap( QPixmap( cor_xpm ) );
m_sagIcon.addPixmap( QPixmap( sag_xpm ) );
m_toolBar->addPushButton( QString( "showAxial" ), QString( "Modules" ), m_axiIcon );
m_toolBar->addPushButton( QString( "showCoronal" ), QString( "Modules" ), m_corIcon );
m_toolBar->addPushButton( QString( "showSagittal" ), QString( "Modules" ), m_sagIcon );
m_toolBar->getButton( QString( "showAxial" ) )->setMaximumSize( 24, 24 );
m_toolBar->getButton( QString( "showCoronal" ) )->setMaximumSize( 24, 24 );
m_toolBar->getButton( QString( "showSagittal" ) )->setMaximumSize( 24, 24 );
m_toolBar->getButton( QString( "showAxial" ) )->setCheckable( true );
m_toolBar->getButton( QString( "showCoronal" ) )->setCheckable( true );
m_toolBar->getButton( QString( "showSagittal" ) )->setCheckable( true );
m_toolBar->getButton( QString( "showAxial" ) )->setChecked( true );
m_toolBar->getButton( QString( "showCoronal" ) )->setChecked( true );
m_toolBar->getButton( QString( "showSagittal" ) )->setChecked( true );
connect( m_toolBar->getButton( QString( "showAxial" ) ),
SIGNAL( pushButtonToggled( QString, bool ) ), m_propertyManager, SLOT( slotBoolChanged( QString, bool ) ) );
connect( m_toolBar->getButton( QString( "showCoronal" ) ),
SIGNAL( pushButtonToggled( QString, bool ) ), m_propertyManager, SLOT( slotBoolChanged( QString, bool ) ) );
connect( m_toolBar->getButton( QString( "showSagittal" ) ),
SIGNAL( pushButtonToggled( QString, bool ) ), m_propertyManager, SLOT( slotBoolChanged( QString, bool ) ) );
mainWindow->addToolBar( Qt::TopToolBarArea, m_toolBar );
}
......
......@@ -38,7 +38,7 @@
#include "signalslib.hpp"
#include "WQtNavGLWidget.h"
#include "WQtRibbonMenu.h"
#include "ribbonMenu/WQtRibbonMenu.h"
#include "WPropertyManager.h"
#include "datasetbrowser/WQtDatasetBrowser.h"
......@@ -96,6 +96,8 @@ public slots:
void openLoadDialog();
private:
void setupToolBar( QMainWindow *mainWindow );
QIcon m_mainWindowIcon;
WPropertyManager* m_propertyManager;
......@@ -110,6 +112,14 @@ private:
WQtNavGLWidget* m_navCoronal;
WQtNavGLWidget* m_navSagittal;
QIcon m_quitIcon;
QIcon m_saveIcon;
QIcon m_loadIcon;
QIcon m_axiIcon;
QIcon m_corIcon;
QIcon m_sagIcon;
boost::signal1< void, std::vector< std::string > > m_loaderSignal;
};
......
......@@ -47,3 +47,4 @@ void WQtPushButton::emitPressed()
emit pushButtonPressed( m_name, true );
emit pushButtonToggled( m_name, this->isChecked() );
}
......@@ -52,6 +52,7 @@ public:
*/
void setName( QString name );
private:
QString m_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/>.
//
//---------------------------------------------------------------------------
#include "WQtMenuPage.h"
WQtMenuPage::WQtMenuPage( QString name )
: QWidget()
{
m_name = name;
m_pageLayout = new QHBoxLayout();
m_pageLayout->addStretch();
this->setLayout( m_pageLayout );
}
WQtMenuPage::~WQtMenuPage()
{
}
QString WQtMenuPage::getName()
{
return m_name;
}
void WQtMenuPage::addButton( WQtPushButton* button )
{
int count = m_pageLayout->count();
m_pageLayout->insertWidget( count -1, button );
this->setLayout( m_pageLayout );
}
//---------------------------------------------------------------------------
//
// 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 WQTMENUPAGE_H
#define WQTMENUPAGE_H
#include <QtGui/QHBoxLayout>
#include <QtGui/QWidget>
#include "../guiElements/WQtPushButton.h"
/**
* TODO(schurade): Document this!
*/
class WQtMenuPage : public QWidget
{
public:
/**
* TODO(schurade): Document this!
*/
explicit WQtMenuPage( QString name );
/**
* TODO(schurade): Document this!
*/
virtual ~WQtMenuPage();
/**
*
*/
void addButton( WQtPushButton* button );
QString getName();
protected:
private:
QHBoxLayout* m_pageLayout;
QString m_name;
};
#endif // WQTMENUPAGE_H
......@@ -22,133 +22,56 @@
//
//---------------------------------------------------------------------------
#include <QtGui/QTabWidget>
#include <QtGui/QHBoxLayout>
#include <cassert>
#include "WQtRibbonMenu.h"
#include "../icons/WIcons.h"
WQtRibbonMenu::WQtRibbonMenu( QWidget* parent )
: QToolBar( parent )
{
setup();
}
WQtRibbonMenu::~WQtRibbonMenu()
{
}
void WQtRibbonMenu::setup()
{
QWidget* filePage = setupFileTab();
QWidget* modulPage = setupModuleTab();
QWidget* helpPage = new QWidget();
QTabWidget* menuTabWidget = new QTabWidget();
menuTabWidget->addTab( filePage, QString( "File" ) );
menuTabWidget->addTab( modulPage, QString( "Modul" ) );
menuTabWidget->addTab( helpPage, QString( "Help" ) );
this->addWidget( menuTabWidget );
this->setAllowedAreas( Qt::TopToolBarArea | Qt::BottomToolBarArea );
}
m_tabWidget = new QTabWidget();
this->addWidget( m_tabWidget );
}
QWidget* WQtRibbonMenu::setupFileTab()
WQtRibbonMenu::~WQtRibbonMenu()
{
m_quitIcon.addPixmap( QPixmap( quit_xpm ) );
m_saveIcon.addPixmap( QPixmap( disc_xpm ) );
m_loadIcon.addPixmap( QPixmap( fileopen_xpm ) );
QWidget* filePage = new QWidget();
m_loadButton = new WQtPushButton( m_loadIcon, QString( "load" ) );
m_saveButton = new WQtPushButton( m_saveIcon, QString( "save" ) );
m_quitButton = new WQtPushButton( m_quitIcon, QString( "exit" ) );
m_loadButton->setMaximumWidth( 50 );
m_saveButton->setMaximumWidth( 50 );
m_quitButton->setMaximumWidth( 50 );
QHBoxLayout* filePageLayout = new QHBoxLayout();
filePageLayout->addWidget( m_loadButton );
filePageLayout->addWidget( m_saveButton );
filePageLayout->addWidget( m_quitButton );
filePageLayout->addStretch();
filePage->setLayout( filePageLayout );
return filePage;
}
QWidget* WQtRibbonMenu::setupModuleTab()
WQtMenuPage* WQtRibbonMenu::addTab( QString name )
{
m_axiIcon.addPixmap( QPixmap( axial_xpm ) );
m_corIcon.addPixmap( QPixmap( cor_xpm ) );
m_sagIcon.addPixmap( QPixmap( sag_xpm ) );
QWidget* modulPage = new QWidget();
m_axiButton = new WQtPushButton( m_axiIcon, QString( "" ) );
m_corButton = new WQtPushButton( m_corIcon, QString( "" ) );
m_sagButton = new WQtPushButton( m_sagIcon, QString( "" ) );
m_axiButton->setName( QString( "showAxial" ) );
m_corButton->setName( QString( "showCoronal" ) );
m_sagButton->setName( QString( "showSagittal" ) );
// don't add a tab with the same name twice
assert( m_tabList.count( name ) == 0 );
m_axiButton->setMaximumWidth( 24 );
m_corButton->setMaximumWidth( 24 );
m_sagButton->setMaximumWidth( 24 );
WQtMenuPage* tab = new WQtMenuPage( name );
m_axiButton->setCheckable( true );
m_corButton->setCheckable( true );
m_sagButton->setCheckable( true );
m_tabWidget->addTab( tab, name );
m_axiButton->setChecked( true );
m_corButton->setChecked( true );
m_sagButton->setChecked( true );
m_tabList[name] = tab;
QHBoxLayout* modulPageLayout = new QHBoxLayout();
modulPageLayout->addWidget( m_axiButton );
modulPageLayout->addWidget( m_corButton );
modulPageLayout->addWidget( m_sagButton );
modulPageLayout->addStretch();
modulPage->setLayout( modulPageLayout );
return modulPage;
return tab;
}
WQtPushButton* WQtRibbonMenu::getLoadButton()
WQtPushButton* WQtRibbonMenu::addPushButton( QString name, QString tabName, QIcon icon, QString label )
{
return m_loadButton;
}
assert( m_tabList.count( tabName ) == 1 );
assert( m_buttonList.count( name ) == 0 );
WQtPushButton* button = new WQtPushButton( icon, label );
button->setName( name );
WQtPushButton* WQtRibbonMenu::getQuitButton()
{
return m_quitButton;
}
WQtPushButton* WQtRibbonMenu::getAxiButton()
{
return m_axiButton;
}
m_tabList[tabName]->addButton( button );
m_buttonList[name] = button;
WQtPushButton* WQtRibbonMenu::getCorButton()
{
return m_corButton;
return button;
}
WQtPushButton* WQtRibbonMenu::getSagButton()
WQtPushButton* WQtRibbonMenu::getButton( QString name )
{
return m_sagButton;
assert( m_buttonList.count( name ) == 1 );
return m_buttonList[name];
}
......@@ -25,9 +25,13 @@
#ifndef WQTRIBBONMENU_H
#define WQTRIBBONMENU_H
#include <map>
#include <QtGui/QTabWidget>
#include <QtGui/QToolBar>
#include "WQtPushButton.h"
#include "WQtMenuPage.h"
#include "../guiElements/WQtPushButton.h"
/**
* implementation of a ribbon menu like widget
*/
......@@ -45,46 +49,27 @@ public:
virtual ~WQtRibbonMenu();
/**
* setup functions for standard (fixed functionality) tabs
*
*/
QWidget* setupFileTab();
WQtMenuPage* addTab( QString name );
/**
* setup functions for standard (fixed functionality) tabs
*
*/
QWidget* setupModuleTab();
WQtPushButton* addPushButton( QString name, QString tabName, QIcon icon, QString label = 0 );
/**
* getter for standard control widgets
*
*/
WQtPushButton* getLoadButton();
WQtPushButton* getQuitButton();
WQtPushButton* getAxiButton();
WQtPushButton* getCorButton();
WQtPushButton* getSagButton();
WQtPushButton* getButton( QString name );
protected:
private:
void setup();
QIcon m_quitIcon;
QIcon m_saveIcon;
QIcon m_loadIcon;
QIcon m_aboutIcon;
QIcon m_axiIcon;
QIcon m_corIcon;
QIcon m_sagIcon;
std::map< QString, WQtMenuPage*>m_tabList;
WQtPushButton* m_loadButton;
WQtPushButton* m_saveButton;
WQtPushButton* m_quitButton;
std::map< QString, WQtPushButton*>m_buttonList;
WQtPushButton* m_axiButton;
WQtPushButton* m_corButton;
WQtPushButton* m_sagButton;
QTabWidget* m_tabWidget;
};
#endif // WQTRIBBONMENU_H
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