/*------------------------------------------------------------------------------ -- This file is a part of the SocExplorer Software -- Copyright (C) 2011, Laboratory of Plasmas Physic - CNRS -- -- 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -------------------------------------------------------------------------------*/ /*-- Author : Alexis Jeandet -- Mail : alexis.jeandet@lpp.polytechnique.fr ----------------------------------------------------------------------------*/ #include "plugininfoswdgt.h" #include "pluginloader.h" #include #include #include #include #include #include #include #include #include pluginInfosWdgt::pluginInfosWdgt(QWidget *parent) : QWidget(parent) { this->mailLayout = new QVBoxLayout; this->textInfos = new QTextBrowser; this->textInfos->setReadOnly(true); this->mailLayout->addWidget(this->textInfos); this->setLayout(this->mailLayout); this->textInfos->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); } void pluginInfosWdgt::updateInfos(const QStringList &items) { this->textInfos->clear(); QTextCursor cursor(this->textInfos->document()); //QTextTable* table; int i=0; cursor.atStart(); cursor.insertText("Plugins:\n"); for(i=0;itextInfos->clear(); QTextCursor cursor(this->textInfos->document()); QTextCharFormat formatHeader(cursor.charFormat()); QTextCharFormat formatContent(cursor.charFormat()); //QTextTable* table; formatHeader.setFontWeight(QFont::Bold); formatHeader.setForeground(QBrush(Qt::red)); formatContent.setForeground(Qt::black); cursor.atStart(); if(pluginloader::checklibrary(pluginPath)==1) { cursor.setBlockCharFormat(formatHeader); cursor.insertText(tr("plugin name:")); //cursor.insertBlock(); cursor.setBlockCharFormat(formatContent); //table = cursor.insertTable(1,1); cursor.insertTable(1,1); cursor.insertText(pluginloader::getlibName(pluginPath)); //table->cellAt( (pluginloader::getlibName(pluginPath)); //this->textInfos->append(pluginloader::getlibName(pluginPath)); //this->textInfos->append("================================"); if(pluginloader::libcanberoot(pluginPath)) { this->textInfos->append(tr("This plugin can be used as root driver.")); } else { this->textInfos->append(tr("This plugin can't' be used as root driver, so it need to be connected to an other plugin.")); } this->textInfos->append("================================"); if(pluginloader::libcanbechild(pluginPath)) { this->textInfos->append(tr("This plugin can be used as child driver.")); } else { this->textInfos->append(tr("This plugin can't' be used as child driver.")); } this->textInfos->append("================================"); this->textInfos->append(tr("plugin VID:")); this->textInfos->append(pluginloader::getlibVIDstr(pluginPath)); this->textInfos->append("================================"); this->textInfos->append(tr("plugin PID:")); this->textInfos->append(pluginloader::getlibPIDstr(pluginPath)); this->textInfos->append("================================"); this->textInfos->append(tr("plugin Version:")); this->textInfos->append(pluginloader::getlibVersion(pluginPath)); this->textInfos->append("================================"); this->textInfos->append(tr("plugin Author:")); this->textInfos->append(pluginloader::getlibAuthor(pluginPath)); this->textInfos->append("================================"); this->textInfos->append(tr("plugin Description:")); this->textInfos->append(pluginloader::getlibDescription(pluginPath)); } else { this->textInfos->setText(tr("This is not a valid plugin.")); } }