/*
 * %kadu copyright begin%
 * Copyright 2013, 2014 Rafał Malinowski (rafal.przemyslaw.malinowski@gmail.com)
 * %kadu copyright end%
 *
 * 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. If not, see <http://www.gnu.org/licenses/>.
 */

#include <QtGui/QTabWidget>

#include "gui/widgets/buddy-configuration-widget.h"
#include "gui/windows/buddy-data-window.h"

#include "buddy-configuration-widget-tab-adapter.h"

BuddyConfigurationWidgetTabAdapter::BuddyConfigurationWidgetTabAdapter(BuddyDataWindow *buddyDataWindow, QTabWidget *tabWidget, QObject *parent) :
		QObject(parent), MyBuddyDataWindow(buddyDataWindow), MyTabWidget(tabWidget)
{
	if (!MyBuddyDataWindow || !MyTabWidget)
		return;

	connect(MyBuddyDataWindow, SIGNAL(widgetAdded(BuddyConfigurationWidget*)), this, SLOT(widgetAdded(BuddyConfigurationWidget*)));

	foreach (BuddyConfigurationWidget *widget, MyBuddyDataWindow->buddyConfigurationWidgets())
		widgetAdded(widget);
}

BuddyConfigurationWidgetTabAdapter::~BuddyConfigurationWidgetTabAdapter()
{
}

void BuddyConfigurationWidgetTabAdapter::widgetAdded(BuddyConfigurationWidget *widget)
{
	MyTabWidget->addTab(widget, widget->windowTitle());
}

#include "moc_buddy-configuration-widget-tab-adapter.cpp"
