Added Enable/Disable buttons to PluginItem and a Info Label, instead of a Checkbox.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5571 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2012-09-19 15:41:31 +00:00
parent b95ecd1109
commit 5016236030
31 changed files with 13271 additions and 14841 deletions

View file

@ -33,18 +33,33 @@ PluginItem::PluginItem(const QString& pluginVersion, int id, const QString& plug
_pluginIcon->setIcon(icon) ;
_pluginIcon->setText(QString()) ;
msgLabel->setText(pluginDescription) ;
subjectLabel->setText(pluginTitle + " "+ pluginVersion) ;
subjectLabel->setText(pluginTitle + " "+ pluginVersion) ;
infoLabel->setText(pluginTitle + " " + tr("will be enabled after your restart RetroShare.")) ;
infoLabel->hide();
QObject::connect(_enabled_CB,SIGNAL(toggled(bool)),this,SLOT(togglePlugin(bool))) ;
QObject::connect(_configure_PB,SIGNAL(clicked()),this,SLOT(configurePlugin())) ;
QObject::connect(_about_PB,SIGNAL(clicked()),this,SLOT(aboutPlugin())) ;
QObject::connect(enableButton,SIGNAL(clicked()),this,SLOT(enablePlugin())) ;
QObject::connect(disableButton,SIGNAL(clicked()),this,SLOT(disablePlugin())) ;
expandFrame->hide();
}
void PluginItem::togglePlugin(bool b)
void PluginItem::enablePlugin()
{
emit( pluginEnabled(b,_hashLabel->text()) ) ;
emit( pluginEnabled(_hashLabel->text()) ) ;
infoLabel->show();
disableButton->show();
enableButton->hide();
}
void PluginItem::disablePlugin()
{
emit( pluginDisabled(_hashLabel->text()) ) ;
infoLabel->hide();
enableButton->show();
disableButton->hide();
}
void PluginItem::aboutPlugin()

View file

@ -31,12 +31,14 @@ class PluginItem: public QWidget, public Ui::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) ;
protected slots:
void togglePlugin(bool) ;
void configurePlugin() ;
void aboutPlugin() ;
void enablePlugin();
void disablePlugin();
signals:
void pluginEnabled(bool,const QString&) ;
void pluginEnabled(const QString&) ;
void pluginDisabled(const QString&) ;
void pluginConfigure(int) ;
void pluginAbout(int) ;

View file

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>788</width>
<height>174</height>
<height>177</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_7">
@ -74,6 +74,18 @@
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QLabel" name="infoLabel">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="subjectLabel">
<property name="sizePolicy">
@ -121,12 +133,15 @@ message here</string>
</item>
<item>
<widget class="QLabel" name="moreinfo_label">
<property name="toolTip">
<string>Show more details about this plugin</string>
</property>
<property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;a href=&quot;more&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;more...&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;a href=&quot;more&quot;&gt;&lt;span style=&quot; font-size:8pt; text-decoration: underline; color:#0000ff;&quot;&gt;More&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
@ -144,12 +159,22 @@ p, li { white-space: pre-wrap; }
</spacer>
</item>
<item>
<widget class="QCheckBox" name="_enabled_CB">
<widget class="QPushButton" name="enableButton">
<property name="toolTip">
<string>Add the plugin into the white list of accepted plugins. This will be effective after you restart RetroShare, since plugins need to be loaded at startup.</string>
<string>Enable this plugin (restart required)</string>
</property>
<property name="text">
<string>Enabled</string>
<string>Enable</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="disableButton">
<property name="toolTip">
<string>Disable this plugin (restart required)</string>
</property>
<property name="text">
<string>Disable</string>
</property>
</widget>
</item>

View file

@ -109,16 +109,24 @@ PluginsPage::PluginsPage(QWidget * parent, Qt::WFlags flags)
ui._pluginsLayout->insertWidget(0,item) ;
if(plugin == NULL || plugin->qt_config_panel() == NULL)
item->_configure_PB->setEnabled(false) ;
if(plugin != NULL)
item->_enabled_CB->setChecked(true) ;
if(plugin != NULL){
item->enableButton->hide();
item->disableButton->show();
}else{
item->enableButton->show();
item->disableButton->hide();
}
if(rsPlugins->getAllowAllPlugins())
item->_enabled_CB->setEnabled(false) ;
//if(rsPlugins->getAllowAllPlugins())
QObject::connect(item,SIGNAL(pluginEnabled(const QString&)),this,SLOT(enablePlugin(const QString&))) ;
QObject::connect(item,SIGNAL(pluginDisabled(const QString&)),this,SLOT(disablePlugin(const QString&))) ;
QObject::connect(item,SIGNAL(pluginEnabled(bool,const QString&)),this,SLOT(togglePlugin(bool,const QString&))) ;
QObject::connect(item,SIGNAL(pluginConfigure(int)),this,SLOT(configurePlugin(int))) ;
QObject::connect(item,SIGNAL(pluginAbout(int)),this,SLOT(aboutPlugin(int))) ;
}
@ -157,16 +165,22 @@ void PluginsPage::configurePlugin(int i)
if(rsPlugins->plugin(i) != NULL && rsPlugins->plugin(i)->qt_config_panel() != NULL)
rsPlugins->plugin(i)->qt_config_panel()->show() ;
}
void PluginsPage::togglePlugin(bool b,const QString& hash)
{
std::cerr << "Switching status of plugin " << hash.toStdString() << " to " << b << std::endl;
if(b)
void PluginsPage::enablePlugin(const QString& hash)
{
std::cerr << "Switching status of plugin " << hash.toStdString() << " to enable" << std::endl;
rsPlugins->enablePlugin(hash.toStdString()) ;
else
}
void PluginsPage::disablePlugin(const QString& hash)
{
std::cerr << "Switching status of plugin " << hash.toStdString() << " to disable " << std::endl;
rsPlugins->disablePlugin(hash.toStdString()) ;
}
PluginsPage::~PluginsPage()
{
}

View file

@ -42,7 +42,9 @@ class PluginsPage : public ConfigPage
public slots:
void togglePlugin(bool b,const QString&) ;
void enablePlugin(const QString&) ;
void disablePlugin(const QString&) ;
void configurePlugin(int i) ;
void aboutPlugin(int i) ;
void toggleEnableAll(bool) ;