2 * This file is part of KDevelop
3 * Copyright 2008 Manuel Breugelmans <mbr.nxi@gmail.com>
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 #include "testtoolviewfactory.h"
22 #include "itestframework.h"
23 #include "itestrunner.h"
24 #include "internal/toolviewdata.h"
26 #include <sublime/view.h>
31 using Veritas::ITestFramework
;
32 using Veritas::ITestRunner
;
33 using Veritas::TestToolViewFactory
;
35 class TestToolViewFactory::TestToolViewFactoryPrivate
38 TestToolViewFactoryPrivate() : framework(0) {}
39 ITestFramework
* framework
; // a kdevelop plugin
42 TestToolViewFactory::TestToolViewFactory(ITestFramework
* framework
)
43 : d(new TestToolViewFactoryPrivate
)
45 d
->framework
= framework
;
48 TestToolViewFactory::~TestToolViewFactory()
53 QWidget
* TestToolViewFactory::create(QWidget
*parent
)
56 ITestRunner
* runner
= d
->framework
->createRunner();
57 QWidget
* runnerWidget
= runner
->runnerWidget();
58 QObject::connect(runnerWidget
, SIGNAL(destroyed(QObject
*)),
59 runner
, SLOT(deleteLater()));
63 Qt::DockWidgetArea
TestToolViewFactory::defaultPosition()
65 return Qt::LeftDockWidgetArea
;
68 QString
TestToolViewFactory::id() const
70 return QString("org.kdevelop.%1TestRunner").arg(d
->framework
->name());
73 void TestToolViewFactory::viewCreated(Sublime::View
* view
)
75 Q_ASSERT(g_toolViewStore
.contains(d
->framework
));
76 ToolViewData
& tv
= g_toolViewStore
[d
->framework
];
77 tv
.registerToolView(view
);