From 871c4ae06f8eb5eeb009bb15b6a7e232968d5c15 Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Tue, 27 Oct 2009 00:35:07 +0100 Subject: [PATCH] Added new DirectorySelectDialog DirectorySelectDialog is another subclass of ResourceSelectDialog, allowing to pick a certain directory via a tree view and a filter line edit. --- include/DirectorySelectDialog.h | 46 +++++++++++++ src/gui/DirectorySelectDialog.cpp | 50 +++++++++++++++ src/gui/Forms/DirectorySelectDialog.ui | 89 ++++++++++++++++++++++++++ 3 files changed, 185 insertions(+) create mode 100644 include/DirectorySelectDialog.h create mode 100644 src/gui/DirectorySelectDialog.cpp create mode 100644 src/gui/Forms/DirectorySelectDialog.ui diff --git a/include/DirectorySelectDialog.h b/include/DirectorySelectDialog.h new file mode 100644 index 000000000..b7aab587c --- /dev/null +++ b/include/DirectorySelectDialog.h @@ -0,0 +1,46 @@ +/* + * DirectorySelectDialog.h - header file for DirectorySelectDialog + * + * Copyright (c) 2009 Tobias Doerffel + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program 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 + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#ifndef _DIRECTORY_SELECT_DIALOG_H +#define _DIRECTORY_SELECT_DIALOG_H + +#include "ResourceSelectDialog.h" + +namespace Ui { class DirectorySelectDialog; } + +class DirectorySelectDialog : public ResourceSelectDialog +{ +public: + DirectorySelectDialog( QWidget * _parent, + DatabaseScope _databaseScope = AllResources ); + ~DirectorySelectDialog(); + + +private: + Ui::DirectorySelectDialog * ui; + +} ; + +#endif + diff --git a/src/gui/DirectorySelectDialog.cpp b/src/gui/DirectorySelectDialog.cpp new file mode 100644 index 000000000..d304555fa --- /dev/null +++ b/src/gui/DirectorySelectDialog.cpp @@ -0,0 +1,50 @@ +/* + * DirectorySelectDialog.cpp - implementation of DirectorySelectDialog + * + * Copyright (c) 2009 Tobias Doerffel + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program 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 + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#include "DirectorySelectDialog.h" + +#include "ui_DirectorySelectDialog.h" + + +DirectorySelectDialog::DirectorySelectDialog( QWidget * _parent, + DatabaseScope _databaseScope ) : + ResourceSelectDialog( _parent, ResourceSelectDialog::TreeModel, + _databaseScope ), + ui( new Ui::DirectorySelectDialog ) +{ + // setup form + ui->setupUi( this ); + + // setup ResourceSelectDialog + setupUi(); +} + + + + +DirectorySelectDialog::~DirectorySelectDialog() +{ +} + + diff --git a/src/gui/Forms/DirectorySelectDialog.ui b/src/gui/Forms/DirectorySelectDialog.ui new file mode 100644 index 000000000..23975f7b5 --- /dev/null +++ b/src/gui/Forms/DirectorySelectDialog.ui @@ -0,0 +1,89 @@ + + + DirectorySelectDialog + + + + 0 + 0 + 465 + 546 + + + + Select directory + + + + + + + + + QAbstractItemView::ScrollPerPixel + + + true + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + ResourceTreeView + QTreeView +
ResourceTreeView.h
+
+
+ + filterEdit + resourceTreeView + buttonBox + + + + + buttonBox + accepted() + DirectorySelectDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + DirectorySelectDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + +