diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/project_window.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/project_window.cpp index cebbfe848..d8ab678a0 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/project_window.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/project_window.cpp @@ -16,6 +16,8 @@ #include "project_window.h" +#include +#include namespace GUIEditor { @@ -25,6 +27,9 @@ namespace GUIEditor setupUi( this ); connect( okButton, SIGNAL( clicked(bool) ), this, SLOT( hide() ) ); connect( cancelButton, SIGNAL( clicked(bool) ), this, SLOT( hide() ) ); + + connect( addButton, SIGNAL( clicked(bool) ), this, SLOT( onAddButtonClicked() ) ); + connect( removeButton, SIGNAL( clicked(bool) ), this, SLOT( onRemoveButtonClicked() ) ); } ProjectWindow::~ProjectWindow() @@ -43,6 +48,44 @@ namespace GUIEditor } fileList->sortItems(); } + + void ProjectWindow::onAddButtonClicked() + { + bool ok; + QString newFile = QInputDialog::getText( this, + tr( "Adding file to project" ), + tr( "Which file do you want to add?" ), + QLineEdit::Normal, + QString(), + &ok ); + + if( ok ) + { + fileList->addItem( newFile ); + fileList->sortItems(); + } + } + + void ProjectWindow::onRemoveButtonClicked() + { + if( fileList->count() == 0 ) + return; + + QMessageBox::StandardButton reply; + QString text; + if( fileList->currentRow() >= 0 ) + text = fileList->item( fileList->currentRow() )->text(); + + reply = QMessageBox::question( this, + tr( "Removing file from project" ), + tr( "Are you sure you want to remove '%1' from the project?" ).arg( text ), + QMessageBox::Yes | QMessageBox::Cancel ); + + QListWidgetItem *item; + if( reply == QMessageBox::Yes ) + item = fileList->takeItem( fileList->currentRow() ); + delete item; + } } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/project_window.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/project_window.h index 155c171e8..26fa28918 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/project_window.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/project_window.h @@ -33,7 +33,12 @@ namespace GUIEditor void setupFileList( const std::vector< std::string > &fileNames ); + private Q_SLOTS: + void onAddButtonClicked(); + void onRemoveButtonClicked(); + private: + }; }