2
* UGENE - Integrated Bioinformatics Tools.
3
* Copyright (C) 2008-2011 UniPro <ugene@unipro.ru>
4
* http://ugene.unipro.ru
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
22
#include "ProjectTreeItemSelectorDialog.h"
23
#include "ProjectTreeItemSelectorDialogImpl.h"
24
#include "ProjectTreeController.h"
26
#include <U2Core/DocumentModel.h>
28
#include <QtGui/QTreeWidget>
29
#include <QtGui/QVBoxLayout>
30
#include <QtGui/QHBoxLayout>
31
#include <QtGui/QSpacerItem>
32
#include <QtGui/QPushButton>
36
ProjectTreeItemSelectorDialogImpl::ProjectTreeItemSelectorDialogImpl(QWidget* p, const ProjectTreeControllerModeSettings& s)
40
controller = new ProjectTreeController(this, treeWidget, s);
41
//TODO: fix bug with double clicking on gobject
42
//connect(controller, SIGNAL(si_doubleClicked(GObject*)), SLOT(sl_objectClicked(GObject*)));
43
acceptByDoubleClick = true;
46
void ProjectTreeItemSelectorDialogImpl::sl_objectClicked(GObject* obj) {
48
Document* d = obj->getDocument();
51
QAction* loadSelectedDocumentsAction = controller->getLoadSeletectedDocumentsAction();
52
assert(loadSelectedDocumentsAction->isEnabled());
53
loadSelectedDocumentsAction->trigger();
57
if (acceptByDoubleClick) {
62
ProjectTreeItemSelectorDialogImpl::~ProjectTreeItemSelectorDialogImpl() {
66
QList<Document*> ProjectTreeItemSelectorDialog::selectDocuments(const ProjectTreeControllerModeSettings& s, QWidget* p) {
68
ProjectTreeItemSelectorDialogImpl d(p, s);
70
if (rc == QDialog::Accepted) {
71
const DocumentSelection* ds = d.controller->getDocumentSelection();
72
res << ds->getSelectedDocuments();
77
QList<GObject*> ProjectTreeItemSelectorDialog::selectObjects(const ProjectTreeControllerModeSettings& s, QWidget* p) {
79
ProjectTreeItemSelectorDialogImpl d(p, s);
81
if (rc == QDialog::Accepted) {
82
const GObjectSelection* os = d.controller->getGObjectSelection();
83
res << os->getSelectedObjects();