2011-07-05 16:29:07 -04:00
|
|
|
/****************************************************************
|
|
|
|
* RetroShare is distributed under the following license:
|
|
|
|
*
|
|
|
|
* Copyright (C) 2011 Cyril Soler
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
****************************************************************/
|
|
|
|
|
|
|
|
#include "PluginItem.h"
|
|
|
|
|
2012-08-15 08:33:46 -04:00
|
|
|
PluginItem::PluginItem(const QString& pluginVersion, int id, const QString& pluginTitle,const QString& pluginDescription,const QString& status, const QString& file_name, const QString& file_hash, const QString& /*error_string*/, const QIcon& icon)
|
2011-07-05 16:29:07 -04:00
|
|
|
:QWidget(NULL)
|
|
|
|
{
|
|
|
|
setupUi(this) ;
|
|
|
|
|
|
|
|
_id = id ;
|
|
|
|
_statusLabel->setText(status) ;
|
|
|
|
_hashLabel->setText(file_hash) ;
|
|
|
|
_name_LE->setText(file_name) ;
|
|
|
|
_pluginIcon->setIcon(icon) ;
|
|
|
|
_pluginIcon->setText(QString()) ;
|
|
|
|
msgLabel->setText(pluginDescription) ;
|
2012-09-19 11:41:31 -04:00
|
|
|
subjectLabel->setText(pluginTitle + " "+ pluginVersion) ;
|
|
|
|
infoLabel->setText(pluginTitle + " " + tr("will be enabled after your restart RetroShare.")) ;
|
|
|
|
infoLabel->hide();
|
2011-07-05 16:29:07 -04:00
|
|
|
|
|
|
|
QObject::connect(_configure_PB,SIGNAL(clicked()),this,SLOT(configurePlugin())) ;
|
2012-09-04 17:59:49 -04:00
|
|
|
QObject::connect(_about_PB,SIGNAL(clicked()),this,SLOT(aboutPlugin())) ;
|
2012-01-04 17:17:28 -05:00
|
|
|
|
2012-09-19 11:41:31 -04:00
|
|
|
QObject::connect(enableButton,SIGNAL(clicked()),this,SLOT(enablePlugin())) ;
|
|
|
|
QObject::connect(disableButton,SIGNAL(clicked()),this,SLOT(disablePlugin())) ;
|
|
|
|
|
2012-01-04 17:17:28 -05:00
|
|
|
expandFrame->hide();
|
2011-07-05 16:29:07 -04:00
|
|
|
}
|
|
|
|
|
2012-09-19 11:41:31 -04:00
|
|
|
void PluginItem::enablePlugin()
|
|
|
|
{
|
|
|
|
emit( pluginEnabled(_hashLabel->text()) ) ;
|
|
|
|
infoLabel->show();
|
|
|
|
disableButton->show();
|
|
|
|
enableButton->hide();
|
|
|
|
}
|
|
|
|
|
|
|
|
void PluginItem::disablePlugin()
|
2011-07-05 16:29:07 -04:00
|
|
|
{
|
2012-09-19 11:41:31 -04:00
|
|
|
emit( pluginDisabled(_hashLabel->text()) ) ;
|
|
|
|
infoLabel->hide();
|
|
|
|
enableButton->show();
|
|
|
|
disableButton->hide();
|
2011-07-05 16:29:07 -04:00
|
|
|
}
|
|
|
|
|
2012-09-04 17:59:49 -04:00
|
|
|
void PluginItem::aboutPlugin()
|
|
|
|
{
|
|
|
|
emit( pluginAbout(_id) ) ;
|
|
|
|
}
|
|
|
|
|
2011-07-05 16:29:07 -04:00
|
|
|
void PluginItem::configurePlugin()
|
|
|
|
{
|
|
|
|
emit( pluginConfigure(_id) ) ;
|
|
|
|
}
|
|
|
|
|
2012-01-04 17:17:28 -05:00
|
|
|
void PluginItem::on_moreinfo_label_linkActivated(QString)
|
|
|
|
{
|
2012-02-26 16:45:52 -05:00
|
|
|
if (expandFrame->isVisible()) {
|
|
|
|
expandFrame->hide();
|
|
|
|
} else {
|
|
|
|
expandFrame->show();
|
|
|
|
}
|
2012-01-04 17:17:28 -05:00
|
|
|
}
|
2011-07-05 16:29:07 -04:00
|
|
|
|