Commit 99b41c74 authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum
Browse files

[ADD] - added project load button

parent a6d462ec
......@@ -51,6 +51,7 @@
#include "../../common/WColor.h"
#include "../../common/WPreferences.h"
#include "../../kernel/WKernel.h"
#include "../../kernel/WModuleProjectFileCombiner.h"
#include "../../modules/data/WMData.h"
#include "../../modules/navSlices/WMNavSlices.h"
......@@ -173,13 +174,18 @@ void WMainWindow::setupPermanentToolBar()
WQtPushButton* loadButton = new WQtPushButton( m_iconManager.getIcon( "load" ), "load", m_permanentToolBar );
WQtPushButton* roiButton = new WQtPushButton( m_iconManager.getIcon( "ROI" ), "ROI", m_permanentToolBar );
WQtPushButton* projectButton = new WQtPushButton( m_iconManager.getIcon( "load" ), "loadProject", m_permanentToolBar );
connect( loadButton, SIGNAL( pressed() ), this, SLOT( openLoadDialog() ) );
connect( roiButton, SIGNAL( pressed() ), this, SLOT( newRoi() ) );
connect( projectButton, SIGNAL( pressed() ), this, SLOT( projectLoad() ) );
loadButton->setToolTip( "Load Data" );
roiButton->setToolTip( "Create New ROI" );
projectButton->setToolTip( "Load a project from file" );
m_permanentToolBar->addWidget( projectButton );
m_permanentToolBar->addSeparator();
m_permanentToolBar->addWidget( loadButton );
m_permanentToolBar->addWidget( roiButton );
......@@ -367,6 +373,31 @@ WQtToolBar* WMainWindow::getCompatiblesToolBar()
return m_compatiblesToolBar;
}
void WMainWindow::projectLoad()
{
QFileDialog fd;
fd.setFileMode( QFileDialog::ExistingFiles );
QStringList filters;
filters << "Simple Project File (*.prj)"
<< "Any files (*)";
fd.setNameFilters( filters );
fd.setViewMode( QFileDialog::Detail );
QStringList fileNames;
if ( fd.exec() )
{
fileNames = fd.selectedFiles();
}
QStringList::const_iterator constIterator;
for ( constIterator = fileNames.constBegin(); constIterator != fileNames.constEnd(); ++constIterator )
{
WModuleProjectFileCombiner proj = WModuleProjectFileCombiner( ( *constIterator ).toStdString(),
WKernel::getRunningKernel()->getRootContainer() );
proj.apply();
}
}
void WMainWindow::openLoadDialog()
{
QFileDialog fd;
......
......@@ -181,6 +181,11 @@ public slots:
*/
void newRoi();
/**
* Gets called whenever the user presses the project button.
*/
void projectLoad();
private:
/**
* Sets up the permanent tool bar.
......
......@@ -180,10 +180,6 @@ void WKernel::threadMain()
}
}
// TODO(ebaum): remove!
WModuleProjectFileCombiner mc = WModuleProjectFileCombiner( "/home/ebaum/test.prj" );
mc.apply();
// actually there is nothing more to do here
waitForStop();
......
......@@ -173,7 +173,6 @@ public:
*/
static std::string getFontPath();
protected:
/**
......@@ -206,6 +205,7 @@ protected:
* The container containing the modules.
*/
boost::shared_ptr< WModuleContainer > m_moduleContainer;
private:
/**
* Loads all the modules it can find.
......
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