[rkward-cvs] rkward/rkward/plugin rkinput.cpp,NONE,1.1 rkinput.h,NONE,1.1 rknote.cpp,NONE,1.1 rknote.h,NONE,1.1 rkpluginbrowser.cpp,NONE,1.1 rkpluginbrowser.h,NONE,1.1 rkpluginmanager.cpp,NONE,1.1 rkpluginmanager.h,NONE,1.1

Pierre ecoch at users.sourceforge.net
Sat Mar 26 10:33:32 UTC 2005


Update of /cvsroot/rkward/rkward/rkward/plugin
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31726/rkward/plugin

Added Files:
	rkinput.cpp rkinput.h rknote.cpp rknote.h rkpluginbrowser.cpp 
	rkpluginbrowser.h rkpluginmanager.cpp rkpluginmanager.h 
Log Message:
Adding plugin widgets (Adrien)

--- NEW FILE: rkinput.h ---
//
// C++ Interface: %{MODULE}
//
// Description: 
//
//
// Author: %{AUTHOR} <%{EMAIL}>, (C) %{YEAR}
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef RKINPUT_H
#define RKINPUT_H

#include <rkpluginwidget.h>
class QTextEdit ; 
class QLabel ; 
class QVBoxLayout;


/**
@author Adrien d'Hardemare
*/
class RKInput : public RKPluginWidget
{
Q_OBJECT
public:
    	RKInput(const QDomElement &element, QWidget *parent, RKPlugin *plugin);
    	~RKInput();
    	void setEnabled(bool);
	QVBoxLayout *vbox	;
private:
	QString depend;
	QTextEdit * textedit ; 
	QLabel * label ;
	QString size ; 
public slots:
	void slotActive();
	void slotActive(bool);
	void textChanged();
protected:
/** Returns the value of the currently selected option. */
	QString value (const QString &modifier);	
};

#endif

--- NEW FILE: rknote.cpp ---
//
// C++ Implementation: %{MODULE}
//
// Description:
//
//
// Author: %{AUTHOR} <%{EMAIL}>, (C) %{YEAR}
//
// Copyright: See COPYING file that comes with this distribution
//
//
#include "rknote.h"
#include <qdom.h>
#include <qlabel.h>
#include <qlayout.h>

#include "../rkglobals.h"


RKNote::RKNote(const QDomElement &element, QWidget *parent, RKPlugin *plugin) : RKPluginWidget (element, parent, plugin) {

	qDebug("creating note");
	QVBoxLayout *vbox = new QVBoxLayout (this, RKGlobals::spacingHint ());
	label = new QLabel (element.attribute ("label", "Select one:"), this);
	vbox->addWidget (label);
	depend = element.attribute ("depend", "");


}


RKNote::~RKNote()
{
}

void RKNote::setEnabled(bool checked){
  label->setEnabled(checked);
  }
void RKNote::slotActive(bool isOk){
label->setEnabled(isOk) ;
}

  
void RKNote::slotActive(){
bool isOk = label->isEnabled();
label->setEnabled(! isOk) ;
}




#include "rknote.moc"

--- NEW FILE: rkpluginmanager.cpp ---
/***************************************************************************
                          rkpluginmanager  -  description
                             -------------------
    begin                : Mon Oct 25 2004
    copyright            : (C) 2004 by Thomas Friedrichsmeier
    email                : tfry at users.sourceforge.net
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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.                                   *
 *                                                                         *
 ***************************************************************************/
#include "rkpluginmanager.h"

RKPluginManager::RKPluginManager()
{
}


RKPluginManager::~RKPluginManager()
{
}



--- NEW FILE: rkpluginbrowser.cpp ---

#include "rkpluginbrowser.h"
#include <qdom.h>
#include <qlayout.h>
#include <qtextedit.h>
#include <qlabel.h>
#include <qvbox.h>
#include <qgrid.h>
#include <rkplugin.h>
#include <qpushbutton.h>
#include <kfiledialog.h>

#include <klocale.h>
#include "../rkglobals.h"
#include <qstring.h>
#include <kurl.h>

// /////////////////////







RKPluginBrowser::RKPluginBrowser(const QDomElement &element, QWidget *parent, RKPlugin *plugin) : RKPluginWidget (element, parent, plugin) {

	qDebug("creating note");
	vbox = new QVBoxLayout (this, RKGlobals::spacingHint ());
	label = new QLabel (element.attribute ("label", "Enter your text"), this);
	textedit = new QTextEdit ( element.attribute ("intial") ,
	QString::null,this, element.attribute ("id")) ;
	button = new QPushButton ("Browser...",this);
//	size = element.attribute ("size", "small");
	vbox->addWidget (label);
	vbox->addWidget (textedit);
	vbox->addWidget (button);
	type = element.attribute("type","file") ;
	filter = element.attribute("filter","") ;
	connect(textedit,SIGNAL(textChanged()),SLOT(textChanged()));
	connect(button,SIGNAL(clicked()),SLOT(slotPopingup()));

	size = element.attribute ("size", "small");
	if (size == "small") {
	textedit->setMaximumSize (300,25) ; 
	textedit->setMinimumSize (300,25) ; 
	}
	else if (size == "big") {
	textedit->setMaximumSize (300,100) ; 
	textedit->setMinimumSize (300,100) ; 
	}
	
	
}


RKPluginBrowser::~RKPluginBrowser()
{
}

void RKPluginBrowser::setEnabled(bool checked){
label->setEnabled(checked);
textedit->setEnabled(checked);
button->setEnabled(checked);
}


void RKPluginBrowser::slotActive(bool isOk){
textedit->setEnabled(isOk) ;
button->setEnabled(isOk) ;
label->setEnabled(isOk) ;
}

  
void RKPluginBrowser::slotActive(){
bool isOk = textedit->isEnabled();
textedit->setEnabled(! isOk) ;
button->setEnabled(! isOk) ;
label->setEnabled(! isOk) ;
}

QString RKPluginBrowser::value (const QString &) {
	return textedit->text();
}


void RKPluginBrowser::textChanged(){
	emit(changed());
}

void RKPluginBrowser::slotPopingup(){
	if (type == "file") {
		QString filename= KFileDialog:: getOpenFileName("",filter,0,"") ; 
		textedit ->setText(filename);
		emit(changed());}
	else if (type=="dir"){
		QString filename= KFileDialog::getExistingDirectory(); 
		textedit ->setText(filename);
		emit(changed());}
	else if (type=="files"){
		QStringList filenames =KFileDialog:: getOpenFileNames("",filter,0,"") ; 
		QString filename = filenames.join( "\n" );
		textedit ->setText(filename);
		emit(changed());
		};
	
}


#include "rkpluginbrowser.moc"

--- NEW FILE: rkpluginbrowser.h ---
//
// C++ Interface: %{MODULE}
//
// Description: 
//
//
// Author: %{Adrien d'Hardemare} <%{EMAIL}>, (C) %{YEAR}
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef RKPLUGINBROWSER_H
#define RKPLUGINBROWSER_H

#include <rkpluginwidget.h>
class QTextEdit ; 
class QLabel ; 
class QVBoxLayout;


/**
@author Adrien d'Hardemare
*/
class QPushButton ; 

class RKPluginBrowser : public RKPluginWidget
{
Q_OBJECT
public:
    	RKPluginBrowser(const QDomElement &element, QWidget *parent, RKPlugin *plugin);
    	~RKPluginBrowser();
    	void setEnabled(bool);
	QVBoxLayout *vbox	;
private:
	QString depend;
	QTextEdit * textedit ; 
	QLabel * label ;
	QPushButton * button ;
	QString type;		
	QString size;		
	QString filter;
public slots:
	void slotActive();
	void slotActive(bool);
	void textChanged();
private slots : 
	void slotPopingup();
protected:
/** Returns the value of the currently selected option. */
	QString value (const QString &modifier);	
};

#endif

--- NEW FILE: rkinput.cpp ---

#include "rkinput.h"
#include <qdom.h>
#include <qlayout.h>
#include <qtextedit.h>
#include <qlabel.h>
#include <qvbox.h>
#include <qgrid.h>
#include <rkplugin.h>
#include "../rkglobals.h"


RKInput::RKInput(const QDomElement &element, QWidget *parent, RKPlugin *plugin) : RKPluginWidget (element, parent, plugin) {

	qDebug("creating note");
	vbox = new QVBoxLayout (this, RKGlobals::spacingHint ());
	label = new QLabel (element.attribute ("label", "Enter your text"), this);
	textedit = new QTextEdit ( element.attribute ("intial") ,
	QString::null,this, element.attribute ("id")) ;
	vbox->addWidget (label);
	vbox->addWidget (textedit);
	connect(textedit,SIGNAL(textChanged()),SLOT(textChanged()));
	
	size = element.attribute ("size", "medium");
	if (size == "small") {
	textedit->setMaximumSize (100,25) ; 
	textedit->setMinimumSize (100,25) ; 
	}
	else if (size == "big") {
	textedit->setMaximumSize (500,200) ; 
	textedit->setMinimumSize (500,200) ; 
	}

	
	//textedit->setMinimumSize (50 , 300) ; 

}


RKInput::~RKInput()
{
}

void RKInput::setEnabled(bool checked){
label->setEnabled(checked);
textedit->setEnabled(checked);
}


void RKInput::slotActive(bool isOk){
textedit->setEnabled(isOk) ;
label->setEnabled(isOk) ;
}

  
void RKInput::slotActive(){
bool isOk = textedit->isEnabled();
textedit->setEnabled(! isOk) ;
label->setEnabled(! isOk) ;
}

QString RKInput::value (const QString &) {
	qDebug("la valeur de edit est %s",textedit->text().latin1());
	return textedit->text();
}


void RKInput::textChanged(){
	emit(changed());
}


#include "rkinput.moc"




--- NEW FILE: rknote.h ---
//
// C++ Interface: %{MODULE}
//
// Description: 
//
//
// Author: %{AUTHOR} <%{EMAIL}>, (C) %{YEAR}
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef RKNOTE_H
#define RKNOTE_H

#include <rkpluginwidget.h>


class QLabel ; 

/**
@author Thomas Friedrichsmeier
*/
class RKNote : public RKPluginWidget
{
Q_OBJECT
public:
    RKNote(const QDomElement &element, QWidget *parent, RKPlugin *plugin);
    ~RKNote();
    void setEnabled(bool);
private:
	QString depend;
	
	QLabel * label ;
public slots:
	void slotActive();
	void slotActive(bool);
	
};

#endif

--- NEW FILE: rkpluginmanager.h ---
/***************************************************************************
                          rkpluginmanager  -  description
                             -------------------
    begin                : Mon Oct 25 2004
    copyright            : (C) 2004 by Thomas Friedrichsmeier
    email                : tfry at users.sourceforge.net
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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.                                   *
 *                                                                         *
 ***************************************************************************/
#ifndef RKPLUGINMANAGER_H
#define RKPLUGINMANAGER_H

/**
This class manages plugins and plugin components. I.e., it keeps a list of them, takes care of making them available in the menus etc.

@author Thomas Friedrichsmeier
*/
class RKPluginManager{
public:
	RKPluginManager();

	~RKPluginManager();
	
	void parseDirectory (const QString &dir);
private:
	void registerComponent (const QString &id, const QString &file);
	void registerImportFilter (const QString &format, const QString &file);
};

#endif





More information about the rkward-tracker mailing list