1 #include <cpBaseQtApplication/PathsDialog.h>
3 #include <cpBaseQtApplication/ui_PathsDialog.h>
6 // -------------------------------------------------------------------------
7 cpBaseQtApplication::PathsDialog::
8 PathsDialog( QWidget* parent, Qt::WindowFlags flags )
9 : QDialog( parent, flags ),
10 m_UI( new Ui::PathsDialog )
12 this->m_UI->setupUi( this );
14 this->m_UI->AddButton, SIGNAL( clicked( ) ),
15 this, SLOT( _addPath( ) )
18 this->m_UI->RemoveButton, SIGNAL( clicked( ) ),
19 this, SLOT( _removePath( ) )
23 // -------------------------------------------------------------------------
24 cpBaseQtApplication::PathsDialog::
30 // -------------------------------------------------------------------------
31 void cpBaseQtApplication::PathsDialog::
32 addPaths( const std::set< std::string >& paths )
35 for( auto i = paths.begin( ); i != paths.end( ); ++i )
37 this->m_UI->Paths->addItems( lst );
40 // -------------------------------------------------------------------------
41 std::set< std::string > cpBaseQtApplication::PathsDialog::
44 std::set< std::string > paths;
45 for( int c = 0; c < this->m_UI->Paths->count( ); ++c )
46 paths.insert( this->m_UI->Paths->item( c )->text( ).toStdString( ) );
50 // -------------------------------------------------------------------------
51 void cpBaseQtApplication::PathsDialog::
55 QFileDialog::getExistingDirectory( this, "Choose a directory", "." );
56 if( res.toStdString( ) != "" )
57 this->m_UI->Paths->addItem( res );
60 // -------------------------------------------------------------------------
61 void cpBaseQtApplication::PathsDialog::
65 auto items = this->m_UI->Paths->selectedItems( );
66 if( items.size( ) == 1 )
67 this->m_UI->Paths->removeItemWidget( items[ 0 ] );