2009-08-11 17:59:40 -04:00
|
|
|
/****************************************************************
|
|
|
|
* RetroShare is distributed under the following license:
|
|
|
|
*
|
|
|
|
* Copyright (C) 2006 - 2009 RetroShare Team
|
|
|
|
*
|
|
|
|
* 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, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
|
|
|
****************************************************************/
|
|
|
|
|
2009-02-01 11:37:07 -05:00
|
|
|
#include <QGroupBox>
|
|
|
|
#include <QFrame>
|
|
|
|
#include <QVBoxLayout>
|
|
|
|
#include <QTabWidget>
|
|
|
|
#include <QLabel>
|
|
|
|
#include <QSizePolicy>
|
2009-02-05 10:29:43 -05:00
|
|
|
#include <QTextEdit>
|
2009-02-01 11:37:07 -05:00
|
|
|
|
2009-02-09 16:01:41 -05:00
|
|
|
//#include <QtPlugin>
|
|
|
|
//#include <QPluginLoader>
|
|
|
|
//#include <QDir>
|
2009-02-01 11:37:07 -05:00
|
|
|
#include <QDebug>
|
2009-02-05 10:29:43 -05:00
|
|
|
#include <QStringList>
|
|
|
|
#include <QRegExp>
|
2009-02-01 11:37:07 -05:00
|
|
|
|
2009-02-09 16:01:41 -05:00
|
|
|
//#include <QApplication> // for qApp->....
|
|
|
|
//#include <QFile>
|
|
|
|
|
2009-02-01 11:37:07 -05:00
|
|
|
#include <QMessageBox>
|
2009-02-05 10:29:43 -05:00
|
|
|
#include <QGroupBox>
|
2009-02-01 11:37:07 -05:00
|
|
|
|
|
|
|
#include "PluginsPage.h"
|
2009-02-05 10:29:43 -05:00
|
|
|
#include "PluginManager.h"
|
2009-02-01 11:37:07 -05:00
|
|
|
|
|
|
|
//==============================================================================
|
|
|
|
|
|
|
|
PluginsPage::PluginsPage(QWidget *parent )
|
2009-02-09 16:01:41 -05:00
|
|
|
// :QGroupBox(parent) // this is for toy applications, do not remove
|
|
|
|
:MainPage(parent) // this for real retroshare app
|
2009-02-01 11:37:07 -05:00
|
|
|
{
|
2009-02-09 16:01:41 -05:00
|
|
|
//===
|
|
|
|
pluginManager = new PluginManager();
|
|
|
|
connect( pluginManager, SIGNAL( newPluginRegistered(QString) ),
|
|
|
|
this , SLOT( pluginRegistered(QString) ) );
|
|
|
|
|
2009-02-05 10:29:43 -05:00
|
|
|
//=== create some gui elements =====
|
2009-02-01 11:37:07 -05:00
|
|
|
pluginPageLayout = new QVBoxLayout(this);
|
|
|
|
|
2009-02-05 10:29:43 -05:00
|
|
|
// this->setTitle("RetroShare plugins");
|
|
|
|
|
|
|
|
pluginTabs = new QTabWidget(this) ;
|
|
|
|
pluginPageLayout->addWidget(pluginTabs);
|
|
|
|
|
2009-02-09 16:01:41 -05:00
|
|
|
pmFrame = new QFrame(this);
|
2009-02-05 10:29:43 -05:00
|
|
|
pmLay = new QVBoxLayout(pmFrame);
|
|
|
|
|
2009-02-09 16:01:41 -05:00
|
|
|
QWidget* tw = pluginManager->getViewWidget();
|
|
|
|
|
|
|
|
pmLay->addWidget( tw );
|
2009-02-05 10:29:43 -05:00
|
|
|
|
|
|
|
pmSpacer = new QSpacerItem(283, 20,
|
2009-02-09 16:01:41 -05:00
|
|
|
QSizePolicy::Expanding, QSizePolicy::Minimum);
|
2009-02-05 10:29:43 -05:00
|
|
|
pmLay->addItem(pmSpacer);
|
|
|
|
|
|
|
|
pluginTabs->addTab( pmFrame, "Manager" ) ;
|
2009-02-01 11:37:07 -05:00
|
|
|
|
|
|
|
|
2009-02-09 16:01:41 -05:00
|
|
|
pluginManager->defaultLoad( ) ;
|
2009-02-01 11:37:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//==============================================================================
|
|
|
|
|
|
|
|
PluginsPage::~PluginsPage()
|
|
|
|
{
|
2009-02-09 16:01:41 -05:00
|
|
|
delete pluginManager;
|
2009-02-05 10:29:43 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
|
|
|
|
void
|
2009-02-09 16:01:41 -05:00
|
|
|
PluginsPage::pluginRegistered(QString pluginName)
|
2009-02-05 10:29:43 -05:00
|
|
|
{
|
2009-02-09 16:01:41 -05:00
|
|
|
//
|
|
|
|
QWidget* pw = pluginManager->pluginWidget( pluginName);
|
2009-02-01 11:37:07 -05:00
|
|
|
|
2009-02-09 16:01:41 -05:00
|
|
|
pluginTabs->addTab( pw , pluginName );
|
2009-02-01 11:37:07 -05:00
|
|
|
}
|
2009-02-05 10:29:43 -05:00
|
|
|
|
|
|
|
//==============================================================================
|