Commit db2ac9b5 by Sebastian Eichelbaum

[CHANGE] renamed Qt5 di qtgui. More universal, especially since I now added Qt4…

[CHANGE] renamed Qt5 di qtgui. More universal, especially since I now added Qt4 compilation again. Our Qt5 code is Qt4 compatible.
parent 48d69409
......@@ -49,4 +49,4 @@ if [ -x "$OPENWALNUT_USEOPTIMUS" ]; then
fi
# Run OpenWalnut
$runner $BINDIR/openwalnut-qt5 "$@"
$runner $BINDIR/openwalnut-qt "$@"
......@@ -2,4 +2,4 @@
set PATH=./lib/;./bin/;./libExt/;%PATH%
:: Finally, run OpenWalnut
openwalnut-qt5.exe
openwalnut-qt.exe
......@@ -92,7 +92,7 @@ ADD_CUSTOM_TARGET( list_install_tarets
# install targets for different parts
ADD_CUSTOM_TARGET( install_runtime
${CMAKE_COMMAND}
-DCOMPONENT=QT5GUI
-DCOMPONENT=QTGUI
-P ${CMAKE_BINARY_DIR}/cmake_install.cmake
)
ADD_CUSTOM_TARGET( install_lib
......@@ -137,12 +137,12 @@ ADD_DEPENDENCIES( install_devdoc core_devdoc )
ADD_SUBDIRECTORY( core )
# -----------------------------------------------------------------------------------------------------------------------------------------------
# QT5 GUI
# QT GUI
OPTION( OW_GUI_QT5 "Enable this to build the QT5-based OpenWalnut GUI." ON )
IF( OW_GUI_QT5 )
OPTION( OW_GUI_QT "Enable this to build the QT-based OpenWalnut GUI." ON )
IF( OW_GUI_QT )
# build
ADD_SUBDIRECTORY( qt5gui )
ADD_SUBDIRECTORY( qtgui )
ENDIF()
......
//---------------------------------------------------------------------------
//
// 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 WROISORTEVENT_H
#define WROISORTEVENT_H
#include <boost/shared_ptr.hpp>
#include <QtCore/QEvent>
#include "../controlPanel/WQtBranchTreeItem.h"
/**
* Event signalling that a sorting of the ROIs needs to be done.
*/
class WRoiSortEvent: public QEvent
{
public:
/**
* Constructor
* \param branch the branch to sort.
*/
explicit WRoiSortEvent( WQtBranchTreeItem* branch );
/**
* Destructor
*/
virtual ~WRoiSortEvent();
/**
* Getter for the branch.
*
* \return the branch.
*/
WQtBranchTreeItem* getBranch();
protected:
/**
* The branch to re-sort.
*/
WQtBranchTreeItem* m_branch;
private:
};
#endif // WROISORTEVENT_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/>.
//
//---------------------------------------------------------------------------
#ifndef WUPDATETEXTURESORTEREVENT_H
#define WUPDATETEXTURESORTEREVENT_H
#include <QtCore/QEvent>
/**
* Event signalling a new module has been associated with the root container in the kernel. Please note that it is possible that
* the module is already marked as "ready" while processing this event due to the multithreading.
*/
class WUpdateTextureSorterEvent: public QEvent
{
public:
/**
* Creates a new event instance denoting that the specified module got associated in the root container.
*/
explicit WUpdateTextureSorterEvent();
/**
* Destructor.
*/
virtual ~WUpdateTextureSorterEvent();
private:
};
#endif // WUPDATETEXTURESORTEREVENT_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 <string>
#include <vector>
#include <QAction>
#include <QFileDialog>
#include "../WQtGui.h"
#include "../WIconManager.h"
#include "../controlPanel/WQtPropertyGroupWidget.h"
#include "core/kernel/WDataModuleInputFilterFile.h"
#include "core/kernel/WDataModuleInputFile.h"
#include "WQtDataModuleInput.h"
WQtDataModuleInput::WQtDataModuleInput( WDataModule::SPtr module, QWidget* parent ):
QWidget( parent ),
m_module( module )
{
setContentsMargins( QMargins( 0, 0, 0, 0 ) );
m_layout = new QVBoxLayout();
m_layout->setMargin( 0 );
m_layout->setContentsMargins( QMargins( 0, 0, 0, 0 ) );
setLayout( m_layout );
m_mainLayout = new QHBoxLayout();
m_mainLayout->setMargin( 0 );
m_mainLayout->setContentsMargins( QMargins( 0, 0, 0, 0 ) );
m_mainWidget = new QWidget();
m_mainWidget->setLayout( m_mainLayout );
// create the clickable toolbutton to open the file
m_changeButton = new QToolButton();
m_reloadButton = new QToolButton();
m_clearButton = new QToolButton();
m_label = new WScaleLabel();
m_label->setText( "UNSET" );
m_changeButton->setAutoRaise( true );
m_reloadButton->setAutoRaise( true );
m_clearButton->setAutoRaise( true );
m_reloadButton->setToolTip( "Force a reload of the data." );
m_changeButton->setToolTip( "Change the source." );
m_clearButton->setToolTip( "Clear the source and set no source." );
m_mainLayout->addWidget( m_reloadButton );
m_mainLayout->addWidget( m_clearButton );
m_mainLayout->addWidget( m_changeButton );
m_mainLayout->addWidget( m_label );
// design the actions for both buttons
WIconManager* iconMgr = WQtGui::getIconManager();
QAction* changeAction = new QAction( iconMgr->getIcon( "load" ), "Change Source", this );
m_changeButton->setDefaultAction( changeAction );
QAction* reloadAction = new QAction( iconMgr->getIcon( "reload" ), "Reload Source", this );
m_reloadButton->setDefaultAction( reloadAction );
QAction* clearAction = new QAction( iconMgr->getIcon( "clear" ), "Clear Source", this );
m_clearButton->setDefaultAction( clearAction );
m_container = WQtPropertyGroupWidget::createPropertyGroupBox( m_mainWidget, false, this, "Source", 2 );
m_layout->addWidget( m_container );
// get notified when the input changes:
m_inputChangeConnection = module->getInputChangedCondition()->subscribeSignal( boost::bind( &WQtDataModuleInput::onInputChange, this ) );
onInputChangeGUI();
// connect the actions
connect( changeAction, SIGNAL( triggered( bool ) ), this, SLOT( onChange() ) );
connect( reloadAction, SIGNAL( triggered( bool ) ), this, SLOT( onReload() ) );
connect( clearAction, SIGNAL( triggered( bool ) ), this, SLOT( onClear() ) );
}
WQtDataModuleInput::~WQtDataModuleInput()
{
m_inputChangeConnection.disconnect();
}
void WQtDataModuleInput::onInputChange()
{
WQtGui::execInGUIThreadAsync( boost::bind( &WQtDataModuleInput::onInputChangeGUI, this ) );
}
void WQtDataModuleInput::onInputChangeGUI()
{
if( m_module->getInput() )
{
m_label->setText( QString::fromStdString( m_module->getInput()->asString() ) );
m_label->setToolTip( QString::fromStdString( m_module->getInput()->getExtendedInfo() ) );
}
else
{
m_label->setText( "UNSET" );
}
}
void WQtDataModuleInput::onChange()
{
QString result;
QString all;
std::vector< WDataModuleInputFilter::ConstSPtr > filters = m_module->getInputFilter();
for( std::vector< WDataModuleInputFilter::ConstSPtr >::const_iterator filterIter = filters.begin(); filterIter != filters.end();
++filterIter )
{
WDataModuleInputFilterFile::ConstSPtr ff = boost::dynamic_pointer_cast< const WDataModuleInputFilterFile >( *filterIter );
if( ff )
{
QString description = QString::fromStdString( ff->getDescription() );
QString extension = QString::fromStdString( ff->getExtension() );
all += QString( " *." ) + extension;
result += description + QString( "(*." ) + extension + QString( ");;" );
}
}
result = QString( "Known file types (" ) + all + QString( ");;" ) + result;
result += QString( "Any files (*)" );
// any current path?
WDataModuleInputFile::SPtr inFile = m_module->getInputAs< WDataModuleInputFile >();
QString defaultPath = "";
if( inFile )
{
boost::filesystem::path p = inFile->getFilename();
defaultPath = QString::fromStdString( p.parent_path().string() );
}
else
{
defaultPath = WQtGui::getSettings().value( "LastOpenPath", "" ).toString();
}
QString filename = QFileDialog::getOpenFileName( this, "Open Data", defaultPath, result );
if( filename == "" )
{
return;
}
// apply
boost::filesystem::path p( filename.toStdString() );
WQtGui::getSettings().setValue( "LastOpenPath", QString::fromStdString( p.parent_path().string() ) );
m_module->setInput( WDataModuleInputFile::SPtr( new WDataModuleInputFile( filename.toStdString() ) ) );
}
void WQtDataModuleInput::onReload()
{
m_module->reload();
}
void WQtDataModuleInput::onClear()
{
m_module->setInput( WDataModuleInput::SPtr() );
}
//---------------------------------------------------------------------------
//
// 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 WQTDATAMODULEINPUT_H
#define WQTDATAMODULEINPUT_H
#include <boost/signals2/signal.hpp>
#include <QWidget>
#include <QHBoxLayout>
#include <QToolButton>
#include "WScaleLabel.h"
#include "core/kernel/WDataModuleInput.h"
#include "core/kernel/WDataModule.h"
/**
* Widget that handles WDataModuleInputs of WDtaModules. Right now it only handles WDataModuleInputFile.
* See #32 for details on how this will be changed.
*/
class WQtDataModuleInput: public QWidget
{
Q_OBJECT
public:
/**
* Constructor.
*
* \param module the data module to handle
* \param parent the parent widget
*/
WQtDataModuleInput( WDataModule::SPtr module, QWidget* parent = NULL );
/**
* Destructor.
*/
virtual ~WQtDataModuleInput();
public slots:
/**
* Called when the user presses the change button
*/
void onChange();
/**
* Triggered for reload
*/
void onReload();
/**
* Clear the source
*/
void onClear();
protected:
private:
/**
* The input to manage
*/
WDataModule::SPtr m_module;
/**
* Container for all
*/
QWidget* m_container;
/**
* This is the main widget containing the reload button, label and the change button it is nested in the container
*/
QWidget* m_mainWidget;
/**
* Layout
*/
QHBoxLayout* m_mainLayout;
/**
* Layout
*/
QVBoxLayout* m_layout;
/**
* The button to open the input dialog.
*/
QToolButton* m_changeButton;
/**
* The reload button
*/
QToolButton* m_reloadButton;
/**
* The clear button
*/
QToolButton* m_clearButton;
/**
* The label
*/
WScaleLabel* m_label;
/**
* Stay informed about changes in the input
*/
boost::signals2::connection m_inputChangeConnection;
/**
* Called by the input change condition.
*/
void onInputChange();
/**
* Called by input change condition in GUI thread.
*/
void onInputChangeGUI();
};
#endif // WQTDATAMODULEINPUT_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 "../WQtGui.h"
#include "../WMainWindow.h"
#include "core/common/WLogger.h"
#include "WQtDockWidget.h"
#include "WQtDockTitleWidget.h"
#define MagicWidgetMinSize 24
WQtDockTitleWidget::WQtDockTitleWidget( WQtDockWidget* parent ):
QWidget( parent ),
m_dockParent( parent )
{
construct();
}
void WQtDockTitleWidget::setupButton( QToolButton* btn )
{
btn->setToolButtonStyle( Qt::ToolButtonIconOnly );
btn->setAutoRaise( true );
}
void WQtDockTitleWidget::setupSizeConstraints( QWidget* widget )
{
widget->setContentsMargins( 0, 0, 0, 0 );
widget->setFixedHeight( MagicWidgetMinSize );
widget->setMinimumSize( MagicWidgetMinSize, MagicWidgetMinSize );
widget->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Fixed ) );
}
void WQtDockTitleWidget::construct()
{
// create titlebar widget and its layout
QHBoxLayout* titleWidgetLayout = new QHBoxLayout( this );
titleWidgetLayout->setMargin( 0 );
titleWidgetLayout->setSpacing( 0 );
setSizePolicy( QSizePolicy( QSizePolicy::Ignored, QSizePolicy::Fixed ) );
// title
m_title = new WScaleLabel( " " + m_dockParent->windowTitle(), 5, this );
m_title->setTextInteractionFlags( Qt::NoTextInteraction );
// close Btn
m_closeBtn = new QToolButton( this );
QAction* closeAction = new QAction( WQtGui::getMainWindow()->getIconManager()->getIcon( "popup_close" ), "Close", this );
connect( closeAction, SIGNAL( triggered( bool ) ), m_dockParent, SLOT( close() ) );
m_closeBtn->setDefaultAction( closeAction );
setupButton( m_closeBtn );
setupSizeConstraints( m_closeBtn );
m_closeBtn->setMinimumSize( MagicWidgetMinSize, MagicWidgetMinSize );
m_closeBtn->setMaximumSize( MagicWidgetMinSize, MagicWidgetMinSize );