Merge branch 'develop' into 1.4_ChartItem
Conflicts: limereport/items/items.qrc limereport/limereport.pri
1
limereport/LRCallbackDS
Normal file
@@ -0,0 +1 @@
|
||||
#include "lrcallbackdatasourceintf.h"
|
1
limereport/LRDataManager
Normal file
@@ -0,0 +1 @@
|
||||
#include "lrdatasourcemanagerintf.h"
|
1
limereport/LRScriptManager
Normal file
@@ -0,0 +1 @@
|
||||
#include "lrscriptenginemanagerintf.h"
|
1
limereport/LimeReport
Normal file
@@ -0,0 +1 @@
|
||||
#include "lrreportengine.h"
|
@@ -79,6 +79,23 @@ bool DataBand::isUnique() const
|
||||
return false;
|
||||
}
|
||||
|
||||
void DataBand::preparePopUpMenu(QMenu &menu)
|
||||
{
|
||||
DataBandDesignIntf::preparePopUpMenu(menu);
|
||||
|
||||
QAction* autoSplittableAction = menu.addAction(tr("useAlternateBackgroundColor"));
|
||||
autoSplittableAction->setCheckable(true);
|
||||
autoSplittableAction->setChecked(useAlternateBackgroundColor());
|
||||
}
|
||||
|
||||
void DataBand::processPopUpAction(QAction *action)
|
||||
{
|
||||
DataBandDesignIntf::processPopUpAction(action);
|
||||
if (action->text().compare(tr("useAlternateBackgroundColor")) == 0){
|
||||
setProperty("useAlternateBackgroundColor",action->isChecked());
|
||||
}
|
||||
}
|
||||
|
||||
QColor DataBand::bandColor() const
|
||||
{
|
||||
return QColor(Qt::darkGreen);
|
||||
|
@@ -48,10 +48,13 @@ class DataBand : public DataBandDesignIntf
|
||||
Q_PROPERTY(bool startNewPage READ startNewPage WRITE setStartNewPage)
|
||||
Q_PROPERTY(bool startFromNewPage READ startFromNewPage WRITE setStartFromNewPage)
|
||||
Q_PROPERTY(QColor alternateBackgroundColor READ alternateBackgroundColor WRITE setAlternateBackgroundColor)
|
||||
Q_PROPERTY(bool useAlternateBackgroundColor READ useAlternateBackgroundColor WRITE setUseAlternateBackgroundColor)
|
||||
public:
|
||||
DataBand(QObject* owner = 0, QGraphicsItem* parent=0);
|
||||
bool isUnique() const;
|
||||
bool isData() const {return true;}
|
||||
void preparePopUpMenu(QMenu &menu);
|
||||
void processPopUpAction(QAction *action);
|
||||
protected:
|
||||
QColor bandColor() const;
|
||||
private:
|
||||
@@ -82,7 +85,7 @@ class DataFooterBand : public BandDesignIntf
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(int columnsCount READ columnsCount WRITE setColumnsCount)
|
||||
Q_PROPERTY(BandColumnsLayoutType columnsFillDirection READ columnsFillDirection WRITE setColumnsFillDirection)
|
||||
Q_PROPERTY(bool printAlways READ printAlways() WRITE setPrintAlways())
|
||||
Q_PROPERTY(bool printAlways READ printAlways WRITE setPrintAlways)
|
||||
public:
|
||||
DataFooterBand(QObject* owner=0, QGraphicsItem* parent=0);
|
||||
bool isUnique() const {return false;}
|
||||
|
@@ -31,7 +31,6 @@
|
||||
#include "lrglobal.h"
|
||||
#include "lrdatasourcemanager.h"
|
||||
|
||||
|
||||
const QString xmlTagHeader = QLatin1String("GroupHeader");
|
||||
const QString xmlTagFooter = QLatin1String("GroupFooter");
|
||||
|
||||
@@ -98,6 +97,8 @@ void GroupBandHeader::startGroup(DataSourceManager* dataManager)
|
||||
if (ds && ds->columnIndexByName(m_groupFiledName)!=-1)
|
||||
m_groupFieldValue=ds->data(m_groupFiledName);
|
||||
}
|
||||
|
||||
if (!m_condition.isEmpty()) m_conditionValue = calcCondition(dataManager);
|
||||
}
|
||||
|
||||
QColor GroupBandHeader::bandColor() const
|
||||
@@ -114,20 +115,48 @@ QString GroupBandHeader::findDataSourceName(BandDesignIntf* parentBand){
|
||||
|
||||
}
|
||||
|
||||
QString GroupBandHeader::condition() const
|
||||
{
|
||||
return m_condition;
|
||||
}
|
||||
|
||||
void GroupBandHeader::setCondition(const QString &condition)
|
||||
{
|
||||
m_condition = condition;
|
||||
}
|
||||
|
||||
QString GroupBandHeader::calcCondition(DataSourceManager* dataManager){
|
||||
QString result = m_condition;
|
||||
if (!m_condition.isEmpty()){
|
||||
result=expandUserVariables(result, FirstPass, NoEscapeSymbols, dataManager);
|
||||
result=expandScripts(result, dataManager);
|
||||
result=expandDataFields(result, NoEscapeSymbols, dataManager);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
bool GroupBandHeader::isNeedToClose(DataSourceManager* dataManager)
|
||||
{
|
||||
if (!m_groupStarted) return false;
|
||||
if (m_groupFiledName.isNull() || m_groupFiledName.isEmpty())
|
||||
if ((m_groupFiledName.isNull() || m_groupFiledName.isEmpty()) && condition().isEmpty()){
|
||||
dataManager->putError(tr("Group field not found"));
|
||||
QString datasourceName = findDataSourceName(parentBand());
|
||||
if (dataManager->containsDatasource(datasourceName)){
|
||||
IDataSource* ds = dataManager->dataSource(datasourceName);
|
||||
if (ds){
|
||||
if (ds->data(m_groupFiledName).isNull() && m_groupFieldValue.isNull()) return false;
|
||||
return ds->data(m_groupFiledName)!=m_groupFieldValue;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!m_condition.isEmpty()){
|
||||
return m_conditionValue != calcCondition(dataManager);
|
||||
} else {
|
||||
dataManager->putError(tr("Datasource \"%1\" not found !!!").arg(datasourceName));
|
||||
QString datasourceName = findDataSourceName(parentBand());
|
||||
if (dataManager->containsDatasource(datasourceName)){
|
||||
IDataSource* ds = dataManager->dataSource(datasourceName);
|
||||
if (ds){
|
||||
if (ds->data(m_groupFiledName).isNull() && m_groupFieldValue.isNull()) return false;
|
||||
if (!ds->data(m_groupFiledName).isValid()) return false;
|
||||
return ds->data(m_groupFiledName)!=m_groupFieldValue;
|
||||
}
|
||||
} else {
|
||||
dataManager->putError(tr("Datasource \"%1\" not found!").arg(datasourceName));
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -141,6 +170,7 @@ bool GroupBandHeader::isStarted()
|
||||
void GroupBandHeader::closeGroup()
|
||||
{
|
||||
m_groupFieldValue=QVariant();
|
||||
m_conditionValue="";
|
||||
m_groupStarted=false;
|
||||
}
|
||||
|
||||
|
@@ -43,6 +43,7 @@ class GroupBandHeader : public BandDesignIntf, public IGroupBand{
|
||||
Q_PROPERTY(bool startNewPage READ startNewPage WRITE setStartNewPage)
|
||||
Q_PROPERTY(bool resetPageNumber READ resetPageNumber WRITE setResetPageNumber)
|
||||
Q_PROPERTY(bool reprintOnEachPage READ reprintOnEachPage WRITE setReprintOnEachPage)
|
||||
Q_PROPERTY(QString condition READ condition WRITE setCondition)
|
||||
public:
|
||||
GroupBandHeader(QObject* owner = 0, QGraphicsItem* parent=0);
|
||||
virtual bool isUnique() const;
|
||||
@@ -57,6 +58,8 @@ public:
|
||||
void setResetPageNumber(bool resetPageNumber);
|
||||
bool isHeader() const{return true;}
|
||||
bool isGroupHeader() const {return true;}
|
||||
QString condition() const;
|
||||
void setCondition(const QString &condition);
|
||||
private:
|
||||
virtual BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0);
|
||||
void startGroup(DataSourceManager* dataManager);
|
||||
@@ -65,12 +68,15 @@ private:
|
||||
void closeGroup();
|
||||
int index();
|
||||
QString findDataSourceName(BandDesignIntf *parentBand);
|
||||
QString calcCondition(DataSourceManager *dataManager);
|
||||
private:
|
||||
QVariant m_groupFieldValue;
|
||||
QString m_groupFiledName;
|
||||
bool m_groupStarted;
|
||||
//bool m_startNewPage;
|
||||
bool m_resetPageNumber;
|
||||
QString m_condition;
|
||||
QString m_conditionValue;
|
||||
};
|
||||
|
||||
class GroupBandFooter : public BandDesignIntf{
|
||||
|
@@ -46,7 +46,7 @@ bool VARIABLE_IS_NOT_USED registred = LimeReport::DesignElementsFactory::instanc
|
||||
namespace LimeReport {
|
||||
|
||||
ReportHeader::ReportHeader(QObject *owner, QGraphicsItem *parent)
|
||||
: BandDesignIntf(LimeReport::BandDesignIntf::ReportHeader,xmlTag,owner,parent) {
|
||||
: BandDesignIntf(LimeReport::BandDesignIntf::ReportHeader,xmlTag,owner,parent), m_printBeforePageHeader(false) {
|
||||
setBandTypeText(tr("Report Header"));
|
||||
setMarkerColor(bandColor());
|
||||
}
|
||||
@@ -60,5 +60,18 @@ QColor ReportHeader::bandColor() const
|
||||
return QColor(152,69,167);
|
||||
}
|
||||
|
||||
bool ReportHeader::printBeforePageHeader() const
|
||||
{
|
||||
return m_printBeforePageHeader;
|
||||
}
|
||||
|
||||
void ReportHeader::setPrintBeforePageHeader(bool printBeforePageHeader)
|
||||
{
|
||||
if (m_printBeforePageHeader != printBeforePageHeader){
|
||||
m_printBeforePageHeader = printBeforePageHeader;
|
||||
notify("printBeforePageHeader",!m_printBeforePageHeader,m_printBeforePageHeader);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -39,11 +39,15 @@ class ReportHeader : public LimeReport::BandDesignIntf
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(bool splittable READ isSplittable WRITE setSplittable )
|
||||
Q_PROPERTY(bool printBeforePageHeader READ printBeforePageHeader WRITE setPrintBeforePageHeader)
|
||||
public:
|
||||
ReportHeader(QObject* owner = 0, QGraphicsItem *parent=0);
|
||||
virtual BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0);
|
||||
bool printBeforePageHeader() const;
|
||||
void setPrintBeforePageHeader(bool printBeforePageHeader);
|
||||
protected:
|
||||
QColor bandColor() const;
|
||||
bool m_printBeforePageHeader;
|
||||
};
|
||||
}
|
||||
#endif // LRREPORTHEADER_H
|
||||
|
@@ -43,9 +43,11 @@ class SubDetailBand : public DataBandDesignIntf
|
||||
Q_PROPERTY(BandColumnsLayoutType columnsFillDirection READ columnsFillDirection WRITE setColumnsFillDirection)
|
||||
Q_PROPERTY(bool keepFooterTogether READ keepFooterTogether WRITE setKeepFooterTogether)
|
||||
Q_PROPERTY(QColor alternateBackgroundColor READ alternateBackgroundColor WRITE setAlternateBackgroundColor)
|
||||
Q_PROPERTY(bool useAlternateBackgroundColor READ useAlternateBackgroundColor WRITE setUseAlternateBackgroundColor)
|
||||
public:
|
||||
SubDetailBand(QObject* owner = 0, QGraphicsItem* parent=0);
|
||||
bool isUnique() const {return false;}
|
||||
int bandNestingLevel(){ return 1;}
|
||||
bool isHasHeader() const;
|
||||
bool isHasFooter() const;
|
||||
private:
|
||||
@@ -63,6 +65,8 @@ class SubDetailHeaderBand : public BandDesignIntf
|
||||
public:
|
||||
SubDetailHeaderBand(QObject* owner = 0, QGraphicsItem* parent=0);
|
||||
bool isUnique() const;
|
||||
bool isHeader() const {return true;}
|
||||
int bandNestingLevel(){ return 1;}
|
||||
protected:
|
||||
QColor bandColor() const;
|
||||
private:
|
||||
@@ -79,6 +83,7 @@ public:
|
||||
SubDetailFooterBand(QObject* owner = 0, QGraphicsItem* parent=0);
|
||||
virtual bool isUnique() const;
|
||||
bool isFooter() const{return true;}
|
||||
int bandNestingLevel(){ return 1;}
|
||||
protected:
|
||||
QColor bandColor() const;
|
||||
private:
|
||||
|
@@ -12,7 +12,7 @@ public:
|
||||
virtual BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0);
|
||||
protected:
|
||||
QColor bandColor() const;
|
||||
bool isUnique(){ return true;}
|
||||
virtual bool isUnique() const {return true;}
|
||||
};
|
||||
|
||||
} // namespace LimeReport
|
||||
|
@@ -41,7 +41,7 @@ namespace LimeReport{
|
||||
|
||||
ConnectionDialog::ConnectionDialog(LimeReport::IConnectionController *conControl, LimeReport::ConnectionDesc* connectionDesc, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::ConnectionDialog),m_connection(connectionDesc),m_controller(conControl)
|
||||
ui(new Ui::ConnectionDialog), m_connection(connectionDesc), m_controller(conControl), m_savedConnectionName("")
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setAttribute(Qt::WA_DeleteOnClose,true);
|
||||
@@ -56,6 +56,7 @@ ConnectionDialog::~ConnectionDialog()
|
||||
void ConnectionDialog::init()
|
||||
{
|
||||
ui->cbbDrivers->addItems(QSqlDatabase::drivers());
|
||||
ui->cbbUseDefaultConnection->setEnabled(!m_controller->containsDefaultConnection());
|
||||
}
|
||||
|
||||
void ConnectionDialog::showEvent(QShowEvent *)
|
||||
@@ -94,40 +95,34 @@ void ConnectionDialog::checkFieldsFill()
|
||||
{
|
||||
if (ui->leConnectionName->text().isEmpty()){throw LimeReport::ReportError(tr("Connection Name is empty"));}
|
||||
if (!m_changeMode&&QSqlDatabase::connectionNames().contains(ui->leConnectionName->text())) {
|
||||
throw LimeReport::ReportError(tr("Connection with name ")+ui->leConnectionName->text()+tr(" already exists "));
|
||||
throw LimeReport::ReportError(tr("Connection with name ")+ui->leConnectionName->text()+tr(" already exists! "));
|
||||
}
|
||||
}
|
||||
|
||||
bool ConnectionDialog::checkConnection()
|
||||
{
|
||||
QScopedPointer<LimeReport::ConnectionDesc> con(uiToConnection());
|
||||
// LimeReport::ConnectionDesc con;
|
||||
// con.setName(ui->leConnectionName->text()+"_check");
|
||||
// con.setHost(ui->leServerName->text());
|
||||
// con.setUserName(ui->leUserName->text());
|
||||
// con.setPassword(ui->lePassword->text());
|
||||
// con.setDatabaseName(ui->leDataBase->text());
|
||||
// con.setDriver(ui->cbbDrivers->currentText());
|
||||
if (!m_controller->checkConnectionDesc(con.data())){
|
||||
throw LimeReport::ReportError(m_controller->lastError());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
LimeReport::ConnectionDesc *ConnectionDialog::uiToConnection(LimeReport::ConnectionDesc* conDesc)
|
||||
ConnectionDesc *ConnectionDialog::uiToConnection(LimeReport::ConnectionDesc* conDesc)
|
||||
{
|
||||
LimeReport::ConnectionDesc* result;
|
||||
if (conDesc)
|
||||
result = conDesc;
|
||||
else
|
||||
result = new LimeReport::ConnectionDesc();
|
||||
result ->setName(ui->leConnectionName->text());
|
||||
result ->setName(ConnectionDesc::connectionNameForReport(ui->leConnectionName->text()));
|
||||
result ->setHost(ui->leServerName->text());
|
||||
result ->setDriver(ui->cbbDrivers->currentText());
|
||||
result ->setUserName(ui->leUserName->text());
|
||||
result ->setPassword(ui->lePassword->text());
|
||||
result ->setDatabaseName(ui->leDataBase->text());
|
||||
result ->setAutoconnect(ui->cbAutoConnect->isChecked());
|
||||
result->setKeepDBCredentials(!ui->cbbKeepCredentials->isChecked());
|
||||
return result ;
|
||||
}
|
||||
|
||||
@@ -135,19 +130,37 @@ void ConnectionDialog::connectionToUI()
|
||||
{
|
||||
init();
|
||||
if (!m_connection) return;
|
||||
ui->leConnectionName->setText(m_connection->name());
|
||||
ui->leConnectionName->setText(ConnectionDesc::connectionNameForUser(m_connection->name()));
|
||||
ui->cbbUseDefaultConnection->setChecked(m_connection->name().compare(QSqlDatabase::defaultConnection) == 0);
|
||||
ui->leDataBase->setText(m_connection->databaseName());
|
||||
ui->leServerName->setText(m_connection->host());
|
||||
ui->leUserName->setText(m_connection->userName());
|
||||
ui->lePassword->setText(m_connection->password());
|
||||
ui->cbbDrivers->setCurrentIndex(ui->cbbDrivers->findText(m_connection->driver()));
|
||||
ui->cbAutoConnect->setChecked(m_connection->autoconnect());
|
||||
ui->cbbKeepCredentials->setChecked(!m_connection->keepDBCredentials());
|
||||
}
|
||||
|
||||
|
||||
void ConnectionDialog::on_toolButton_clicked()
|
||||
{
|
||||
ui->leDataBase->setText(QFileDialog::getOpenFileName());
|
||||
}
|
||||
|
||||
void ConnectionDialog::on_cbbUseDefaultConnection_toggled(bool checked)
|
||||
{
|
||||
if (checked){
|
||||
m_savedConnectionName = ui->leConnectionName->text();
|
||||
ui->leConnectionName->setText(tr("defaultConnection"));
|
||||
ui->leConnectionName->setEnabled(false);
|
||||
} else {
|
||||
ui->leConnectionName->setText(m_savedConnectionName);
|
||||
ui->leConnectionName->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace LimeReport
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -50,7 +50,7 @@ protected:
|
||||
void init();
|
||||
void checkFieldsFill();
|
||||
bool checkConnection();
|
||||
LimeReport::ConnectionDesc* uiToConnection(LimeReport::ConnectionDesc *conDesc = 0);
|
||||
ConnectionDesc* uiToConnection(LimeReport::ConnectionDesc *conDesc = 0);
|
||||
void connectionToUI();
|
||||
signals:
|
||||
void conectionRegistred(LimeReport::ConnectionDesc* connectionDesc);
|
||||
@@ -58,11 +58,14 @@ private slots:
|
||||
void slotAccept();
|
||||
void slotCheckConnection();
|
||||
void on_toolButton_clicked();
|
||||
void on_cbbUseDefaultConnection_toggled(bool checked);
|
||||
|
||||
private:
|
||||
Ui::ConnectionDialog *ui;
|
||||
LimeReport::ConnectionDesc* m_connection;
|
||||
ConnectionDesc* m_connection;
|
||||
bool m_changeMode;
|
||||
LimeReport::IConnectionController* m_controller;
|
||||
IConnectionController* m_controller;
|
||||
QString m_savedConnectionName;
|
||||
};
|
||||
|
||||
} // namespace LimeReport
|
||||
|
@@ -36,6 +36,13 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="cbbUseDefaultConnection">
|
||||
<property name="text">
|
||||
<string>Use default application connection</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
@@ -130,6 +137,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="cbbKeepCredentials">
|
||||
<property name="text">
|
||||
<string>Dont keep credentals in lrxml</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
|
@@ -126,17 +126,17 @@ void DataBrowser::slotSQLEditingFinished(SQLEditResult result)
|
||||
|
||||
void DataBrowser::slotDeleteConnection()
|
||||
{
|
||||
if (!getConnectionName().isEmpty()){
|
||||
if (!getConnectionName(NameForUser).isEmpty()){
|
||||
if (
|
||||
QMessageBox::critical(
|
||||
this,
|
||||
tr("Attention"),
|
||||
tr("Do you really want to delete \"%1\" connection ?").arg(getConnectionName()),
|
||||
tr("Do you really want to delete \"%1\" connection?").arg(getConnectionName(NameForUser)),
|
||||
QMessageBox::Ok|QMessageBox::No,
|
||||
QMessageBox::No
|
||||
)==QMessageBox::Ok
|
||||
) == QMessageBox::Ok
|
||||
){
|
||||
m_report->dataManager()->removeConnection(getConnectionName());
|
||||
m_report->dataManager()->removeConnection(getConnectionName(NameForReport));
|
||||
updateDataTree();
|
||||
}
|
||||
}
|
||||
@@ -153,7 +153,7 @@ void DataBrowser::slotAddDataSource()
|
||||
#endif
|
||||
sqlEdit->setSettings(settings());
|
||||
sqlEdit->setDataSources(m_report->dataManager());
|
||||
sqlEdit->setDefaultConnection(getConnectionName());
|
||||
sqlEdit->setDefaultConnection(getConnectionName(NameForReport));
|
||||
connect(sqlEdit,SIGNAL(signalSqlEditingFinished(SQLEditResult)),this,SLOT(slotSQLEditingFinished(SQLEditResult)));
|
||||
sqlEdit->exec();
|
||||
}
|
||||
@@ -173,7 +173,10 @@ void DataBrowser::updateDataTree()
|
||||
foreach(QString dataSourceName, m_report->datasourcesNames()){
|
||||
|
||||
QTreeWidgetItem *item=new QTreeWidgetItem(QStringList(dataSourceName),DataBrowserTree::Table);
|
||||
QTreeWidgetItem *parentItem = findByNameAndType(m_report->dataManager()->connectionName(dataSourceName),DataBrowserTree::Connection);
|
||||
QTreeWidgetItem *parentItem = findByNameAndType(
|
||||
ConnectionDesc::connectionNameForUser(m_report->dataManager()->connectionName(dataSourceName)),
|
||||
DataBrowserTree::Connection
|
||||
);
|
||||
if (parentItem){
|
||||
parentItem->addChild(item);
|
||||
if (!parentItem->isExpanded()) ui->dataTree->expandItem(parentItem);
|
||||
@@ -336,11 +339,18 @@ QTreeWidgetItem* findConnectionItem(QTreeWidgetItem* item){
|
||||
}
|
||||
}
|
||||
|
||||
QString DataBrowser::getConnectionName()
|
||||
QString DataBrowser::getConnectionName(NameType nameType)
|
||||
{
|
||||
if (ui->dataTree->currentItem()){
|
||||
QTreeWidgetItem * ci = findConnectionItem(ui->dataTree->currentItem());
|
||||
if (ci) return ci->text(0);
|
||||
if (ci) {
|
||||
switch (nameType) {
|
||||
case NameForUser:
|
||||
return ConnectionDesc::connectionNameForUser(ci->text(0));
|
||||
case NameForReport:
|
||||
return ConnectionDesc::connectionNameForReport(ci->text(0));
|
||||
}
|
||||
}
|
||||
else return QString();
|
||||
};
|
||||
return QString();
|
||||
@@ -385,7 +395,7 @@ void DataBrowser::slotDeleteDatasource()
|
||||
QMessageBox::critical(
|
||||
this,
|
||||
tr("Attention"),
|
||||
tr("Do you really want to delete \"%1\" datasource ?").arg(datasourceName),
|
||||
tr("Do you really want to delete \"%1\" datasource?").arg(datasourceName),
|
||||
QMessageBox::Ok|QMessageBox::No,
|
||||
QMessageBox::No
|
||||
) == QMessageBox::Ok
|
||||
@@ -416,14 +426,58 @@ void DataBrowser::initConnections()
|
||||
{
|
||||
ui->dataTree->clear();
|
||||
QList<QTreeWidgetItem *>items;
|
||||
foreach(QString connectionName,m_report->dataManager()->connectionNames()){
|
||||
QTreeWidgetItem *item=new QTreeWidgetItem(ui->dataTree,QStringList(connectionName), DataBrowserTree::Connection);
|
||||
if (m_report->dataManager()->isConnectionConnected(connectionName))
|
||||
|
||||
QStringList connections = QSqlDatabase::connectionNames();
|
||||
foreach(QString connectionName, m_report->dataManager()->connectionNames()){
|
||||
if (!connections.contains(connectionName,Qt::CaseInsensitive)){
|
||||
connections.append(connectionName);
|
||||
}
|
||||
}
|
||||
qSort(connections);
|
||||
foreach (QString connectionName, connections) {
|
||||
QTreeWidgetItem *item=new QTreeWidgetItem(
|
||||
ui->dataTree,
|
||||
QStringList(ConnectionDesc::connectionNameForUser(connectionName)),
|
||||
DataBrowserTree::Connection
|
||||
);
|
||||
if (!m_report->dataManager()->connectionNames().contains(ConnectionDesc::connectionNameForReport(connectionName), Qt::CaseInsensitive))
|
||||
{
|
||||
item->setIcon(0,QIcon(":/databrowser/images/database_connected"));
|
||||
else
|
||||
item->setIcon(0,QIcon(":/databrowser/images/database_disconnected"));
|
||||
} else {
|
||||
if (m_report->dataManager()->isConnectionConnected(connectionName))
|
||||
item->setIcon(0,QIcon(":/databrowser/images/database_connected"));
|
||||
else
|
||||
item->setIcon(0,QIcon(":/databrowser/images/database_disconnected"));
|
||||
}
|
||||
items.append(item);
|
||||
}
|
||||
|
||||
|
||||
// foreach (QString connectionName, connections) {
|
||||
// QTreeWidgetItem *item=new QTreeWidgetItem(
|
||||
// ui->dataTree,
|
||||
// QStringList(ConnectionDesc::connectionNameForUser(connectionName)),
|
||||
// DataBrowserTree::Connection
|
||||
// );
|
||||
// item->setIcon(0,QIcon(":/databrowser/images/database_connected"));
|
||||
// }
|
||||
|
||||
// connections = m_report->dataManager()->connectionNames();
|
||||
// qSort(connections);
|
||||
// foreach(QString connectionName,connectionName){
|
||||
// if (!QSqlDatabase::contains(connectionName)){
|
||||
// QTreeWidgetItem *item=new QTreeWidgetItem(
|
||||
// ui->dataTree,
|
||||
// QStringList(ConnectionDesc::connectionNameForUser(connectionName)),
|
||||
// DataBrowserTree::Connection
|
||||
// );
|
||||
// if (m_report->dataManager()->isConnectionConnected(connectionName))
|
||||
// item->setIcon(0,QIcon(":/databrowser/images/database_connected"));
|
||||
// else
|
||||
// item->setIcon(0,QIcon(":/databrowser/images/database_disconnected"));
|
||||
// items.append(item);
|
||||
// }
|
||||
// }
|
||||
ui->dataTree->insertTopLevelItems(0,items);
|
||||
}
|
||||
|
||||
@@ -482,10 +536,10 @@ void DataBrowser::slotDataWindowClosed()
|
||||
|
||||
void DataBrowser::slotChangeConnection()
|
||||
{
|
||||
if (!getConnectionName().isEmpty()){
|
||||
if (!getConnectionName(NameForUser).isEmpty()){
|
||||
ConnectionDialog *connectionEdit = new ConnectionDialog(
|
||||
this,
|
||||
m_report->dataManager()->connectionByName(getConnectionName()),
|
||||
m_report->dataManager()->connectionByName(getConnectionName(NameForReport)),
|
||||
this
|
||||
);
|
||||
connectionEdit->setAttribute(Qt::WA_DeleteOnClose,true);
|
||||
@@ -501,7 +555,7 @@ void DataBrowser::slotChangeConnection()
|
||||
|
||||
void DataBrowser::slotChangeConnectionState()
|
||||
{
|
||||
QString connectionName = getConnectionName();
|
||||
QString connectionName = getConnectionName(NameForReport);
|
||||
if (!connectionName.isEmpty()){
|
||||
if (!m_report->dataManager()->isConnectionConnected(connectionName)){
|
||||
setCursor(Qt::WaitCursor);
|
||||
@@ -626,6 +680,13 @@ bool DataBrowser::checkConnectionDesc(ConnectionDesc *connection)
|
||||
return result;
|
||||
}
|
||||
|
||||
bool DataBrowser::containsDefaultConnection()
|
||||
{
|
||||
bool result = m_report->dataManager()->connectionByName(QSqlDatabase::defaultConnection) ||
|
||||
QSqlDatabase::contains(QSqlDatabase::defaultConnection);
|
||||
return result;
|
||||
}
|
||||
|
||||
QString DataBrowser::lastError() const
|
||||
{
|
||||
return m_lastError;
|
||||
@@ -640,7 +701,7 @@ void DataBrowser::on_dataTree_currentItemChanged(QTreeWidgetItem *current, QTree
|
||||
{
|
||||
Q_UNUSED(previous)
|
||||
if (current&&(current->type() == DataBrowserTree::Connection)) {
|
||||
ui->pbConnect->setEnabled(true);
|
||||
bool internalConnection = m_report->dataManager()->connectionByName(ConnectionDesc::connectionNameForReport(current->text(0)));
|
||||
if (m_report->dataManager()->isConnectionConnected(current->text(0))){
|
||||
ui->pbConnect->setIcon(QIcon(":/databrowser/images/plug-connect.png"));
|
||||
} else {
|
||||
@@ -648,9 +709,10 @@ void DataBrowser::on_dataTree_currentItemChanged(QTreeWidgetItem *current, QTree
|
||||
}
|
||||
ui->editDataSource->setEnabled(false);
|
||||
ui->deleteDataSource->setEnabled(false);
|
||||
ui->viewDataSource->setEnabled(false);
|
||||
ui->changeConnection->setEnabled(true);
|
||||
ui->deleteConection->setEnabled(true);
|
||||
ui->viewDataSource->setEnabled(false);
|
||||
ui->pbConnect->setEnabled(internalConnection);
|
||||
ui->changeConnection->setEnabled(internalConnection);
|
||||
ui->deleteConection->setEnabled(internalConnection);
|
||||
ui->errorMessage->setDisabled(true);
|
||||
} else {
|
||||
ui->changeConnection->setEnabled(false);
|
||||
@@ -704,7 +766,7 @@ void DataBrowser::on_deleteVariable_clicked()
|
||||
{
|
||||
QString varName = getVariable();
|
||||
if (!varName.isEmpty()){
|
||||
if (QMessageBox::critical(this,tr("Attention"),QString(tr("Do you really want to delete variable \"%1\" ?")).arg(varName),
|
||||
if (QMessageBox::critical(this,tr("Attention"),QString(tr("Do you really want to delete variable \"%1\"?")).arg(varName),
|
||||
QMessageBox::Ok|QMessageBox::Cancel, QMessageBox::Cancel
|
||||
)==QMessageBox::Ok){
|
||||
m_report->dataManager()->deleteVariable(varName);
|
||||
@@ -778,4 +840,4 @@ void DataBrowser::on_variablesTree_itemDoubleClicked(QTreeWidgetItem *item, int
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace LimeReport
|
||||
} // namespace LimeReport
|
||||
|
@@ -87,8 +87,9 @@ private slots:
|
||||
void on_variablesTree_itemDoubleClicked(QTreeWidgetItem *item, int);
|
||||
|
||||
private:
|
||||
enum NameType{NameForUser, NameForReport};
|
||||
QString getDatasourceName();
|
||||
QString getConnectionName();
|
||||
QString getConnectionName(NameType nameType);
|
||||
QString getVariable();
|
||||
bool isClosingWindows() const {return m_closingWindows;}
|
||||
QTreeWidgetItem * findByNameAndType(QString name, int itemType);
|
||||
@@ -108,6 +109,7 @@ private:
|
||||
void addConnectionDesc(ConnectionDesc *connection);
|
||||
void changeConnectionDesc(ConnectionDesc *connection);
|
||||
bool checkConnectionDesc(ConnectionDesc *connection);
|
||||
bool containsDefaultConnection();
|
||||
|
||||
private:
|
||||
Ui::DataBrowser* ui;
|
||||
|
@@ -101,7 +101,7 @@ void SQLEditDialog::accept()
|
||||
else result.resultMode=SQLEditResult::SubProxy;
|
||||
}
|
||||
|
||||
result.connectionName=ui->cbbConnection->currentText();
|
||||
result.connectionName = ConnectionDesc::connectionNameForReport(ui->cbbConnection->currentText());
|
||||
result.datasourceName=ui->leDatasourceName->text();
|
||||
result.sql=ui->textEditSQL->toPlainText();
|
||||
result.dialogMode=m_dialogMode;
|
||||
@@ -147,11 +147,11 @@ void SQLEditDialog::hideEvent(QHideEvent *)
|
||||
|
||||
void SQLEditDialog::check()
|
||||
{
|
||||
if (ui->leDatasourceName->text().isEmpty()) throw LimeReport::ReportError(tr("Datasource Name is empty !"));
|
||||
if (ui->textEditSQL->toPlainText().isEmpty() && (!ui->rbProxy) ) throw LimeReport::ReportError(tr("SQL is empty !"));
|
||||
if (ui->leDatasourceName->text().isEmpty()) throw LimeReport::ReportError(tr("Datasource Name is empty!"));
|
||||
if (ui->textEditSQL->toPlainText().isEmpty() && (!ui->rbProxy) ) throw LimeReport::ReportError(tr("SQL is empty!"));
|
||||
if (m_dialogMode==AddMode){
|
||||
if (m_datasources->containsDatasource(ui->leDatasourceName->text())){
|
||||
throw LimeReport::ReportError(QString(tr("Datasource with name: \"%1\" already exists !")).arg(ui->leDatasourceName->text()));
|
||||
throw LimeReport::ReportError(QString(tr("Datasource with name: \"%1\" already exists!")).arg(ui->leDatasourceName->text()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -159,15 +159,19 @@ void SQLEditDialog::check()
|
||||
void SQLEditDialog::initConnections()
|
||||
{
|
||||
foreach(QString connectionName, QSqlDatabase::connectionNames()){
|
||||
ui->cbbConnection->addItem(QIcon(":/databrowser/images/plug-connect.png"),connectionName);
|
||||
ui->cbbConnection->addItem(QIcon(":/databrowser/images/plug-connect.png"),ConnectionDesc::connectionNameForUser(connectionName));
|
||||
}
|
||||
|
||||
foreach(QString connectionName, m_datasources->connectionNames()){
|
||||
connectionName = (connectionName.compare(QSqlDatabase::defaultConnection)==0) ?
|
||||
tr("defaultConnection") : connectionName;
|
||||
if (ui->cbbConnection->findText(connectionName,Qt::MatchExactly )==-1)
|
||||
ui->cbbConnection->addItem(QIcon(":/databrowser/images/plug-disconnect.png"),connectionName);
|
||||
ui->cbbConnection->addItem(QIcon(":/databrowser/images/plug-disconnect.png"),ConnectionDesc::connectionNameForUser(connectionName));
|
||||
}
|
||||
|
||||
ui->cbbConnection->setCurrentIndex(ui->cbbConnection->findText(m_defaultConnection));
|
||||
if (!m_oldDatasourceName.isEmpty()){
|
||||
ui->cbbConnection->setCurrentIndex(ui->cbbConnection->findText(m_datasources->connectionName(m_oldDatasourceName)));
|
||||
ui->cbbConnection->setCurrentIndex(ui->cbbConnection->findText(ConnectionDesc::connectionNameForUser(m_datasources->connectionName(m_oldDatasourceName))));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -202,7 +206,7 @@ void SQLEditDialog::setDataSources(LimeReport::DataSourceManager *dataSources, Q
|
||||
|
||||
void SQLEditDialog::setDefaultConnection(QString defaultConnection)
|
||||
{
|
||||
m_defaultConnection=defaultConnection;
|
||||
m_defaultConnection = ConnectionDesc::connectionNameForUser(defaultConnection);
|
||||
}
|
||||
|
||||
void SQLEditDialog::slotDataSourceNameEditing()
|
||||
@@ -298,7 +302,11 @@ void SQLEditDialog::slotPreviewData()
|
||||
QMessageBox::critical(this,tr("Attention"),tr("Connection is not specified"));
|
||||
return;
|
||||
}
|
||||
m_previewModel = m_datasources->previewSQL(ui->cbbConnection->currentText(),ui->textEditSQL->toPlainText(),ui->leMaster->text());
|
||||
m_previewModel = m_datasources->previewSQL(
|
||||
ConnectionDesc::connectionNameForReport(ui->cbbConnection->currentText()),
|
||||
ui->textEditSQL->toPlainText(),
|
||||
ui->leMaster->text()
|
||||
);
|
||||
if (m_previewModel){
|
||||
ui->tvPreview->setModel(m_previewModel.data());
|
||||
ui->gbDataPreview->setVisible(true);
|
||||
|
109
limereport/dialogdesigner/3rdparty/designer/pluginmanager_p.h
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License versions 2.0 or 3.0 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.GPL included in
|
||||
** the packaging of this file. Please review the following information
|
||||
** to ensure GNU General Public Licensing requirements will be met:
|
||||
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
|
||||
** http://www.gnu.org/copyleft/gpl.html. In addition, as a special
|
||||
** exception, Nokia gives you certain additional rights. These rights
|
||||
** are described in the Nokia Qt GPL Exception version 1.3, included in
|
||||
** the file GPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** Qt for Windows(R) Licensees
|
||||
** As a special exception, Nokia, as the sole copyright holder for Qt
|
||||
** Designer, grants users of the Qt/Eclipse Integration plug-in the
|
||||
** right for the Qt/Eclipse Integration to link to functionality
|
||||
** provided by Qt Designer and its related libraries.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at qt-sales@nokia.com.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists for the convenience
|
||||
// of Qt Designer. This header
|
||||
// file may change from version to version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#ifndef PLUGINMANAGER_H
|
||||
#define PLUGINMANAGER_H
|
||||
|
||||
#include "shared_global_p.h"
|
||||
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QStringList>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QDesignerFormEditorInterface;
|
||||
class QDesignerCustomWidgetInterface;
|
||||
class QDesignerPluginManagerPrivate;
|
||||
|
||||
class QDESIGNER_SHARED_EXPORT QDesignerPluginManager: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit QDesignerPluginManager(QDesignerFormEditorInterface *core);
|
||||
virtual ~QDesignerPluginManager();
|
||||
|
||||
QDesignerFormEditorInterface *core() const;
|
||||
|
||||
QObject *instance(const QString &plugin) const;
|
||||
|
||||
QStringList registeredPlugins() const;
|
||||
|
||||
QStringList findPlugins(const QString &path);
|
||||
|
||||
QStringList pluginPaths() const;
|
||||
void setPluginPaths(const QStringList &plugin_paths);
|
||||
|
||||
QStringList disabledPlugins() const;
|
||||
void setDisabledPlugins(const QStringList &disabled_plugins);
|
||||
|
||||
QStringList failedPlugins() const;
|
||||
QString failureReason(const QString &pluginName) const;
|
||||
|
||||
QList<QObject*> instances() const;
|
||||
QList<QDesignerCustomWidgetInterface*> registeredCustomWidgets() const;
|
||||
|
||||
bool registerNewPlugins();
|
||||
|
||||
public slots:
|
||||
bool syncSettings();
|
||||
void ensureInitialized();
|
||||
|
||||
private:
|
||||
void updateRegisteredPlugins();
|
||||
void registerPath(const QString &path);
|
||||
void registerPlugin(const QString &plugin);
|
||||
|
||||
private:
|
||||
static QStringList defaultPluginPaths();
|
||||
|
||||
QDesignerPluginManagerPrivate *m_d;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // PLUGINMANAGER_H
|
126
limereport/dialogdesigner/3rdparty/designer/qdesigner_integration_p.h
vendored
Normal file
@@ -0,0 +1,126 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License versions 2.0 or 3.0 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.GPL included in
|
||||
** the packaging of this file. Please review the following information
|
||||
** to ensure GNU General Public Licensing requirements will be met:
|
||||
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
|
||||
** http://www.gnu.org/copyleft/gpl.html. In addition, as a special
|
||||
** exception, Nokia gives you certain additional rights. These rights
|
||||
** are described in the Nokia Qt GPL Exception version 1.3, included in
|
||||
** the file GPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** Qt for Windows(R) Licensees
|
||||
** As a special exception, Nokia, as the sole copyright holder for Qt
|
||||
** Designer, grants users of the Qt/Eclipse Integration plug-in the
|
||||
** right for the Qt/Eclipse Integration to link to functionality
|
||||
** provided by Qt Designer and its related libraries.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at qt-sales@nokia.com.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists for the convenience
|
||||
// of Qt Designer. This header
|
||||
// file may change from version to version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#ifndef QDESIGNER_INTEGRATION_H
|
||||
#define QDESIGNER_INTEGRATION_H
|
||||
|
||||
#include "shared_global_p.h"
|
||||
#include <QtDesigner/QDesignerIntegrationInterface>
|
||||
|
||||
#include <QtCore/QObject>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QDesignerFormEditorInterface;
|
||||
class QDesignerFormWindowInterface;
|
||||
class QDesignerResourceBrowserInterface;
|
||||
|
||||
class QVariant;
|
||||
class QWidget;
|
||||
|
||||
namespace qdesigner_internal {
|
||||
|
||||
struct Selection;
|
||||
class QDesignerIntegrationPrivate;
|
||||
|
||||
class QDESIGNER_SHARED_EXPORT QDesignerIntegration: public QDesignerIntegrationInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit QDesignerIntegration(QDesignerFormEditorInterface *core, QObject *parent = 0);
|
||||
virtual ~QDesignerIntegration();
|
||||
|
||||
static void requestHelp(const QDesignerFormEditorInterface *core, const QString &manual, const QString &document);
|
||||
|
||||
virtual QWidget *containerWindow(QWidget *widget) const;
|
||||
|
||||
// Load plugins into widget database and factory.
|
||||
static void initializePlugins(QDesignerFormEditorInterface *formEditor);
|
||||
void emitObjectNameChanged(QDesignerFormWindowInterface *formWindow, QObject *object, const QString &newName, const QString &oldName);
|
||||
|
||||
// Create a resource browser specific to integration. Language integration takes precedence
|
||||
virtual QDesignerResourceBrowserInterface *createResourceBrowser(QWidget *parent = 0);
|
||||
|
||||
signals:
|
||||
void propertyChanged(QDesignerFormWindowInterface *formWindow, const QString &name, const QVariant &value);
|
||||
void objectNameChanged(QDesignerFormWindowInterface *formWindow, QObject *object, const QString &newName, const QString &oldName);
|
||||
void helpRequested(const QString &manual, const QString &document);
|
||||
|
||||
public slots:
|
||||
virtual void updateProperty(const QString &name, const QVariant &value, bool enableSubPropertyHandling);
|
||||
// Additional signals of designer property editor
|
||||
// virtual void updatePropertyComment(const QString &name, const QString &value);
|
||||
virtual void resetProperty(const QString &name);
|
||||
virtual void addDynamicProperty(const QString &name, const QVariant &value);
|
||||
virtual void removeDynamicProperty(const QString &name);
|
||||
|
||||
|
||||
virtual void updateActiveFormWindow(QDesignerFormWindowInterface *formWindow);
|
||||
virtual void setupFormWindow(QDesignerFormWindowInterface *formWindow);
|
||||
virtual void updateSelection();
|
||||
virtual void updateGeometry();
|
||||
virtual void activateWidget(QWidget *widget);
|
||||
|
||||
void updateCustomWidgetPlugins();
|
||||
|
||||
private slots:
|
||||
void updatePropertyPrivate(const QString &name, const QVariant &value);
|
||||
|
||||
private:
|
||||
void initialize();
|
||||
void getSelection(Selection &s);
|
||||
QObject *propertyEditorObject();
|
||||
|
||||
QDesignerIntegrationPrivate *m_d;
|
||||
};
|
||||
|
||||
} // namespace qdesigner_internal
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QDESIGNER_INTEGRATION_H
|
72
limereport/dialogdesigner/3rdparty/designer/shared_global_p.h
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License versions 2.0 or 3.0 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.GPL included in
|
||||
** the packaging of this file. Please review the following information
|
||||
** to ensure GNU General Public Licensing requirements will be met:
|
||||
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
|
||||
** http://www.gnu.org/copyleft/gpl.html. In addition, as a special
|
||||
** exception, Nokia gives you certain additional rights. These rights
|
||||
** are described in the Nokia Qt GPL Exception version 1.3, included in
|
||||
** the file GPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** Qt for Windows(R) Licensees
|
||||
** As a special exception, Nokia, as the sole copyright holder for Qt
|
||||
** Designer, grants users of the Qt/Eclipse Integration plug-in the
|
||||
** right for the Qt/Eclipse Integration to link to functionality
|
||||
** provided by Qt Designer and its related libraries.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at qt-sales@nokia.com.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists for the convenience
|
||||
// of Qt Designer. This header
|
||||
// file may change from version to version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#ifndef SHARED_GLOBAL_H
|
||||
#define SHARED_GLOBAL_H
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
|
||||
#ifdef QT_DESIGNER_STATIC
|
||||
#define QDESIGNER_SHARED_EXTERN
|
||||
#define QDESIGNER_SHARED_IMPORT
|
||||
#else
|
||||
#define QDESIGNER_SHARED_EXTERN Q_DECL_EXPORT
|
||||
#define QDESIGNER_SHARED_IMPORT Q_DECL_IMPORT
|
||||
#endif
|
||||
|
||||
#ifndef QT_NO_SHARED_EXPORT
|
||||
# ifdef QDESIGNER_SHARED_LIBRARY
|
||||
# define QDESIGNER_SHARED_EXPORT QDESIGNER_SHARED_EXTERN
|
||||
# else
|
||||
# define QDESIGNER_SHARED_EXPORT QDESIGNER_SHARED_IMPORT
|
||||
# endif
|
||||
#else
|
||||
# define QDESIGNER_SHARED_EXPORT
|
||||
#endif
|
||||
|
||||
#endif // SHARED_GLOBAL_H
|
10
limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/README.txt
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
This is a new Designer integration, started on 28.02.2008.
|
||||
|
||||
The reason for it is the introduction of layout caching
|
||||
in Qt 4.4, which unearthed a lot of mainwindow-size related
|
||||
bugs in Designer and all integrations.
|
||||
|
||||
The goal of it is to have a closed layout chain from
|
||||
integration top level to form window.
|
||||
|
||||
Friedemann
|
11
limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/designerintegration.pri
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
INCLUDEPATH *= $$PWD $$PWD/..
|
||||
|
||||
SOURCES += $$PWD/widgethost.cpp \
|
||||
$$PWD/sizehandlerect.cpp \
|
||||
$$PWD/formresizer.cpp
|
||||
|
||||
HEADERS += $$PWD/widgethost.h \
|
||||
$$PWD/sizehandlerect.h \
|
||||
$$PWD/formresizer.h \
|
||||
$$PWD/widgethostconstants.h \
|
||||
$$PWD/../namespace_global.h
|
198
limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/formresizer.cpp
vendored
Normal file
@@ -0,0 +1,198 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at qt-sales@nokia.com.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "formresizer.h"
|
||||
#include "sizehandlerect.h"
|
||||
#include "widgethostconstants.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
#include <QDesignerFormWindowInterface>
|
||||
|
||||
#include <QResizeEvent>
|
||||
#include <QPalette>
|
||||
#include <QLayout>
|
||||
#include <QFrame>
|
||||
#include <QResizeEvent>
|
||||
|
||||
enum { debugFormResizer = 0 };
|
||||
|
||||
using namespace SharedTools::Internal;
|
||||
|
||||
FormResizer::FormResizer(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
m_frame(new QFrame),
|
||||
m_formWindow(0)
|
||||
{
|
||||
// Make the resize grip of a mainwindow form find us as resizable window.
|
||||
setWindowFlags(windowFlags() | Qt::SubWindow);
|
||||
setBackgroundRole(QPalette::Base);
|
||||
|
||||
QVBoxLayout *handleLayout = new QVBoxLayout(this);
|
||||
handleLayout->setMargin(SELECTION_MARGIN);
|
||||
handleLayout->addWidget(m_frame);
|
||||
|
||||
m_frame->setFrameStyle(QFrame::Panel | QFrame::Raised);
|
||||
QVBoxLayout *layout = new QVBoxLayout(m_frame);
|
||||
layout->setMargin(0);
|
||||
// handles
|
||||
m_handles.reserve(SizeHandleRect::Left);
|
||||
for (int i = SizeHandleRect::LeftTop; i <= SizeHandleRect::Left; ++i) {
|
||||
SizeHandleRect *shr = new SizeHandleRect(this, static_cast<SizeHandleRect::Direction>(i), this);
|
||||
connect(shr, SIGNAL(mouseButtonReleased(QRect,QRect)), this, SIGNAL(formWindowSizeChanged(QRect,QRect)));
|
||||
m_handles.push_back(shr);
|
||||
}
|
||||
setState(SelectionHandleActive);
|
||||
updateGeometry();
|
||||
}
|
||||
|
||||
void FormResizer::updateGeometry()
|
||||
{
|
||||
const QRect &geom = m_frame->geometry();
|
||||
|
||||
if (debugFormResizer)
|
||||
qDebug() << "FormResizer::updateGeometry() " << size() << " frame " << geom;
|
||||
|
||||
const int w = SELECTION_HANDLE_SIZE;
|
||||
const int h = SELECTION_HANDLE_SIZE;
|
||||
|
||||
const Handles::iterator hend = m_handles.end();
|
||||
for (Handles::iterator it = m_handles.begin(); it != hend; ++it) {
|
||||
SizeHandleRect *hndl = *it;;
|
||||
switch (hndl->dir()) {
|
||||
case SizeHandleRect::LeftTop:
|
||||
hndl->move(geom.x() - w / 2, geom.y() - h / 2);
|
||||
break;
|
||||
case SizeHandleRect::Top:
|
||||
hndl->move(geom.x() + geom.width() / 2 - w / 2, geom.y() - h / 2);
|
||||
break;
|
||||
case SizeHandleRect::RightTop:
|
||||
hndl->move(geom.x() + geom.width() - w / 2, geom.y() - h / 2);
|
||||
break;
|
||||
case SizeHandleRect::Right:
|
||||
hndl->move(geom.x() + geom.width() - w / 2, geom.y() + geom.height() / 2 - h / 2);
|
||||
break;
|
||||
case SizeHandleRect::RightBottom:
|
||||
hndl->move(geom.x() + geom.width() - w / 2, geom.y() + geom.height() - h / 2);
|
||||
break;
|
||||
case SizeHandleRect::Bottom:
|
||||
hndl->move(geom.x() + geom.width() / 2 - w / 2, geom.y() + geom.height() - h / 2);
|
||||
break;
|
||||
case SizeHandleRect::LeftBottom:
|
||||
hndl->move(geom.x() - w / 2, geom.y() + geom.height() - h / 2);
|
||||
break;
|
||||
case SizeHandleRect::Left:
|
||||
hndl->move(geom.x() - w / 2, geom.y() + geom.height() / 2 - h / 2);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FormResizer::update()
|
||||
{
|
||||
const Handles::iterator hend = m_handles.end();
|
||||
for (Handles::iterator it = m_handles.begin(); it != hend; ++it) {
|
||||
(*it)->update();
|
||||
}
|
||||
}
|
||||
|
||||
void FormResizer::setState(SelectionHandleState st)
|
||||
{
|
||||
if (debugFormResizer)
|
||||
qDebug() << "FormResizer::setState " << st;
|
||||
|
||||
const Handles::iterator hend = m_handles.end();
|
||||
for (Handles::iterator it = m_handles.begin(); it != hend; ++it)
|
||||
(*it)->setState(st);
|
||||
}
|
||||
|
||||
void FormResizer::setFormWindow(QDesignerFormWindowInterface *fw)
|
||||
{
|
||||
if (debugFormResizer)
|
||||
qDebug() << "FormResizer::setFormWindow " << fw;
|
||||
QVBoxLayout *layout = qobject_cast<QVBoxLayout *>(m_frame->layout());
|
||||
Q_ASSERT(layout);
|
||||
if (layout->count())
|
||||
delete layout->takeAt(0);
|
||||
m_formWindow = fw;
|
||||
|
||||
if (m_formWindow)
|
||||
layout->addWidget(m_formWindow);
|
||||
mainContainerChanged();
|
||||
connect(fw, SIGNAL(mainContainerChanged(QWidget*)), this, SLOT(mainContainerChanged()));
|
||||
}
|
||||
|
||||
void FormResizer::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
if (debugFormResizer)
|
||||
qDebug() << ">FormResizer::resizeEvent" << event->size();
|
||||
updateGeometry();
|
||||
QWidget::resizeEvent(event);
|
||||
if (debugFormResizer)
|
||||
qDebug() << "<FormResizer::resizeEvent";
|
||||
}
|
||||
|
||||
QSize FormResizer::decorationSize() const
|
||||
{
|
||||
const int lineWidth = m_frame->lineWidth();
|
||||
const QMargins frameMargins = m_frame->contentsMargins();
|
||||
const int margin = 2* SELECTION_MARGIN;
|
||||
QSize size = QSize( margin, margin );
|
||||
size += QSize( qMax( frameMargins.left(), lineWidth ), qMax( frameMargins.top(), lineWidth ) );
|
||||
size += QSize( qMax( frameMargins.right(), lineWidth ), qMax( frameMargins.bottom(), lineWidth ) );
|
||||
return size;
|
||||
}
|
||||
|
||||
QWidget *FormResizer::mainContainer()
|
||||
{
|
||||
if (m_formWindow)
|
||||
return m_formWindow->mainContainer();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void FormResizer::mainContainerChanged()
|
||||
{
|
||||
const QSize maxWidgetSize = QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX);
|
||||
if (const QWidget *mc = mainContainer()) {
|
||||
// Set Maximum size which is not handled via a hint (as opposed to minimum size)
|
||||
const QSize maxWidgetSize = QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX);
|
||||
const QSize formMaxSize = mc->maximumSize();
|
||||
QSize newMaxSize = maxWidgetSize;
|
||||
if (formMaxSize != maxWidgetSize)
|
||||
newMaxSize = formMaxSize + decorationSize();
|
||||
if (debugFormResizer)
|
||||
qDebug() << "FormResizer::mainContainerChanged" << mc << " Size " << mc->size()<< newMaxSize;
|
||||
setMaximumSize(newMaxSize);
|
||||
resize(decorationSize() + mc->size());
|
||||
} else {
|
||||
setMaximumSize(maxWidgetSize);
|
||||
}
|
||||
}
|
99
limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/formresizer.h
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at qt-sales@nokia.com.
|
||||
**
|
||||
**************************************************************************/
|
||||
#ifndef FORMRESIZER_H
|
||||
#define FORMRESIZER_H
|
||||
|
||||
#include "namespace_global.h"
|
||||
|
||||
#include "widgethostconstants.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QVector>
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QDesignerFormWindowInterface)
|
||||
QT_FORWARD_DECLARE_CLASS(QFrame)
|
||||
|
||||
namespace SharedTools {
|
||||
namespace Internal {
|
||||
|
||||
class SizeHandleRect;
|
||||
|
||||
/* A window to embed a form window interface as follows:
|
||||
*
|
||||
* Widget
|
||||
* |
|
||||
* +---+----+
|
||||
* | |
|
||||
* | |
|
||||
* Handles QVBoxLayout [margin: SELECTION_MARGIN]
|
||||
* |
|
||||
* Frame [margin: lineWidth]
|
||||
* |
|
||||
* QVBoxLayout
|
||||
* |
|
||||
* QDesignerFormWindowInterface
|
||||
*
|
||||
* Can be embedded into a QScrollArea. */
|
||||
|
||||
class FormResizer : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
FormResizer(QWidget *parent = 0);
|
||||
|
||||
void updateGeometry();
|
||||
void setState(SelectionHandleState st);
|
||||
void update();
|
||||
|
||||
void setFormWindow(QDesignerFormWindowInterface *fw);
|
||||
|
||||
signals:
|
||||
void formWindowSizeChanged(const QRect &oldGeo, const QRect &newGeo);
|
||||
|
||||
protected:
|
||||
virtual void resizeEvent(QResizeEvent *event);
|
||||
|
||||
private slots:
|
||||
void mainContainerChanged();
|
||||
|
||||
private:
|
||||
QSize decorationSize() const;
|
||||
QWidget *mainContainer();
|
||||
|
||||
QFrame *m_frame;
|
||||
typedef QVector<SizeHandleRect*> Handles;
|
||||
Handles m_handles;
|
||||
QDesignerFormWindowInterface * m_formWindow;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace SharedTools
|
||||
|
||||
#endif // FORMRESIZER_H
|
188
limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/sizehandlerect.cpp
vendored
Normal file
@@ -0,0 +1,188 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at qt-sales@nokia.com.
|
||||
**
|
||||
**************************************************************************/
|
||||
#include "sizehandlerect.h"
|
||||
#include "widgethostconstants.h"
|
||||
|
||||
#include <QDesignerFormWindowInterface>
|
||||
|
||||
#include <QMouseEvent>
|
||||
#include <QPainter>
|
||||
#include <QFrame>
|
||||
#include <QDebug>
|
||||
|
||||
enum { debugSizeHandle = 0 };
|
||||
|
||||
using namespace SharedTools::Internal;
|
||||
|
||||
SizeHandleRect::SizeHandleRect(QWidget *parent, Direction d, QWidget *resizable) :
|
||||
QWidget(parent),
|
||||
m_dir(d),
|
||||
m_resizable(resizable),
|
||||
m_state(SelectionHandleOff)
|
||||
{
|
||||
setBackgroundRole(QPalette::Text);
|
||||
setAutoFillBackground(true);
|
||||
|
||||
setFixedSize(SELECTION_HANDLE_SIZE, SELECTION_HANDLE_SIZE);
|
||||
setMouseTracking(false);
|
||||
updateCursor();
|
||||
}
|
||||
|
||||
void SizeHandleRect::updateCursor()
|
||||
{
|
||||
switch (m_dir) {
|
||||
case Right:
|
||||
case RightTop:
|
||||
setCursor(Qt::SizeHorCursor);
|
||||
return;
|
||||
case RightBottom:
|
||||
setCursor(Qt::SizeFDiagCursor);
|
||||
return;
|
||||
case LeftBottom:
|
||||
case Bottom:
|
||||
setCursor(Qt::SizeVerCursor);
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
setCursor(Qt::ArrowCursor);
|
||||
}
|
||||
|
||||
void SizeHandleRect::paintEvent(QPaintEvent *)
|
||||
{
|
||||
switch (m_state) {
|
||||
case SelectionHandleOff:
|
||||
break;
|
||||
case SelectionHandleInactive: {
|
||||
QPainter p(this);
|
||||
p.setPen(Qt::red);
|
||||
p.drawRect(0, 0, width() - 1, height() - 1);
|
||||
}
|
||||
break;
|
||||
case SelectionHandleActive: {
|
||||
QPainter p(this);
|
||||
p.setPen(Qt::blue);
|
||||
p.drawRect(0, 0, width() - 1, height() - 1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void SizeHandleRect::mousePressEvent(QMouseEvent *e)
|
||||
{
|
||||
e->accept();
|
||||
|
||||
if (e->button() != Qt::LeftButton)
|
||||
return;
|
||||
|
||||
m_startSize = m_curSize = m_resizable->size();
|
||||
m_startPos = m_curPos = m_resizable->mapFromGlobal(e->globalPos());
|
||||
if (debugSizeHandle)
|
||||
qDebug() << "SizeHandleRect::mousePressEvent" << m_startSize << m_startPos << m_curPos;
|
||||
|
||||
}
|
||||
|
||||
void SizeHandleRect::mouseMoveEvent(QMouseEvent *e)
|
||||
{
|
||||
if (!(e->buttons() & Qt::LeftButton))
|
||||
return;
|
||||
|
||||
// Try resize with delta against start position.
|
||||
// We don't take little deltas in consecutive move events as this
|
||||
// causes the handle and the mouse cursor to become out of sync
|
||||
// once a min/maxSize limit is hit. When the cursor reenters the valid
|
||||
// areas, it will now snap to it.
|
||||
m_curPos = m_resizable->mapFromGlobal(e->globalPos());
|
||||
QSize delta = QSize(m_curPos.x() - m_startPos.x(), m_curPos.y() - m_startPos.y());
|
||||
switch (m_dir) {
|
||||
case Right:
|
||||
case RightTop: // Only width
|
||||
delta.setHeight(0);
|
||||
break;
|
||||
case RightBottom: // All dimensions
|
||||
break;
|
||||
case LeftBottom:
|
||||
case Bottom: // Only height
|
||||
delta.setWidth(0);
|
||||
break;
|
||||
default:
|
||||
delta = QSize(0, 0);
|
||||
break;
|
||||
}
|
||||
if (delta != QSize(0, 0))
|
||||
tryResize(delta);
|
||||
}
|
||||
|
||||
void SizeHandleRect::mouseReleaseEvent(QMouseEvent *e)
|
||||
{
|
||||
if (e->button() != Qt::LeftButton)
|
||||
return;
|
||||
|
||||
e->accept();
|
||||
if (m_startSize != m_curSize) {
|
||||
const QRect startRect = QRect(0, 0, m_startPos.x(), m_startPos.y());
|
||||
const QRect newRect = QRect(0, 0, m_curPos.x(), m_curPos.y());
|
||||
if (debugSizeHandle)
|
||||
qDebug() << "SizeHandleRect::mouseReleaseEvent" << startRect << newRect;
|
||||
emit mouseButtonReleased(startRect, newRect);
|
||||
}
|
||||
}
|
||||
|
||||
void SizeHandleRect::tryResize(const QSize &delta)
|
||||
{
|
||||
// Try resize with delta against start position
|
||||
QSize newSize = m_startSize + delta;
|
||||
newSize = newSize.expandedTo(m_resizable->minimumSizeHint());
|
||||
newSize = newSize.expandedTo(m_resizable->minimumSize());
|
||||
newSize = newSize.boundedTo(m_resizable->maximumSize());
|
||||
if (newSize == m_resizable->size())
|
||||
return;
|
||||
if (debugSizeHandle)
|
||||
qDebug() << "SizeHandleRect::tryResize by (" << m_startSize << '+' << delta << ')' << newSize;
|
||||
m_resizable->resize(newSize);
|
||||
m_curSize = m_resizable->size();
|
||||
}
|
||||
|
||||
void SizeHandleRect::setState(SelectionHandleState st)
|
||||
{
|
||||
if (st == m_state)
|
||||
return;
|
||||
switch (st) {
|
||||
case SelectionHandleOff:
|
||||
hide();
|
||||
break;
|
||||
case SelectionHandleInactive:
|
||||
case SelectionHandleActive:
|
||||
show();
|
||||
raise();
|
||||
break;
|
||||
}
|
||||
m_state = st;
|
||||
}
|
82
limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/sizehandlerect.h
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at qt-sales@nokia.com.
|
||||
**
|
||||
**************************************************************************/
|
||||
#ifndef SIZEHANDLERECT_H
|
||||
#define SIZEHANDLERECT_H
|
||||
|
||||
#include "namespace_global.h"
|
||||
|
||||
#include "widgethostconstants.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QPoint>
|
||||
|
||||
namespace SharedTools {
|
||||
namespace Internal {
|
||||
|
||||
class SizeHandleRect : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum Direction { LeftTop, Top, RightTop, Right, RightBottom, Bottom, LeftBottom, Left };
|
||||
|
||||
SizeHandleRect(QWidget *parent, Direction d, QWidget *resizable);
|
||||
|
||||
Direction dir() const { return m_dir; }
|
||||
void updateCursor();
|
||||
void setState(SelectionHandleState st);
|
||||
|
||||
signals:
|
||||
|
||||
void mouseButtonReleased(const QRect &, const QRect &);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *e);
|
||||
void mousePressEvent(QMouseEvent *e);
|
||||
void mouseMoveEvent(QMouseEvent *e);
|
||||
void mouseReleaseEvent(QMouseEvent *e);
|
||||
|
||||
private:
|
||||
void tryResize(const QSize &delta);
|
||||
|
||||
private:
|
||||
const Direction m_dir;
|
||||
QPoint m_startPos;
|
||||
QPoint m_curPos;
|
||||
QSize m_startSize;
|
||||
QSize m_curSize;
|
||||
QWidget *m_resizable;
|
||||
SelectionHandleState m_state;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace SharedTools
|
||||
|
||||
|
||||
#endif // SIZEHANDLERECT_H
|
||||
|
111
limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/widgethost.cpp
vendored
Normal file
@@ -0,0 +1,111 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at qt-sales@nokia.com.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "widgethost.h"
|
||||
#include "formresizer.h"
|
||||
#include "widgethostconstants.h"
|
||||
|
||||
#include <QDesignerFormWindowInterface>
|
||||
#include <QDesignerFormWindowCursorInterface>
|
||||
|
||||
#include <QPalette>
|
||||
#include <QLayout>
|
||||
#include <QFrame>
|
||||
#include <QResizeEvent>
|
||||
#include <QDebug>
|
||||
|
||||
using namespace SharedTools;
|
||||
|
||||
// ---------- WidgetHost
|
||||
WidgetHost::WidgetHost(QWidget *parent, QDesignerFormWindowInterface *formWindow) :
|
||||
QScrollArea(parent),
|
||||
m_formWindow(0),
|
||||
m_formResizer(new Internal::FormResizer)
|
||||
{
|
||||
setWidget(m_formResizer);
|
||||
// Re-set flag (gets cleared by QScrollArea): Make the resize grip of a mainwindow form find the resizer as resizable window.
|
||||
m_formResizer->setWindowFlags(m_formResizer->windowFlags() | Qt::SubWindow);
|
||||
setFormWindow(formWindow);
|
||||
}
|
||||
|
||||
WidgetHost::~WidgetHost()
|
||||
{
|
||||
if (m_formWindow)
|
||||
delete m_formWindow;
|
||||
}
|
||||
|
||||
void WidgetHost::setFormWindow(QDesignerFormWindowInterface *fw)
|
||||
{
|
||||
m_formWindow = fw;
|
||||
if (!fw)
|
||||
return;
|
||||
|
||||
m_formResizer->setFormWindow(fw);
|
||||
|
||||
setBackgroundRole(QPalette::Base);
|
||||
m_formWindow->setAutoFillBackground(true);
|
||||
m_formWindow->setBackgroundRole(QPalette::Background);
|
||||
|
||||
connect(m_formResizer, SIGNAL(formWindowSizeChanged(QRect, QRect)),
|
||||
this, SLOT(fwSizeWasChanged(QRect, QRect)));
|
||||
connect(m_formWindow, SIGNAL(destroyed(QObject*)), this, SLOT(formWindowDeleted(QObject*)));
|
||||
}
|
||||
|
||||
QSize WidgetHost::formWindowSize() const
|
||||
{
|
||||
if (!m_formWindow || !m_formWindow->mainContainer())
|
||||
return QSize();
|
||||
return m_formWindow->mainContainer()->size();
|
||||
}
|
||||
|
||||
void WidgetHost::fwSizeWasChanged(const QRect &, const QRect &)
|
||||
{
|
||||
// newGeo is the mouse coordinates, thus moving the Right will actually emit wrong height
|
||||
emit formWindowSizeChanged(formWindowSize().width(), formWindowSize().height());
|
||||
}
|
||||
|
||||
void WidgetHost::formWindowDeleted(QObject *object)
|
||||
{
|
||||
if (object == m_formWindow) m_formWindow = 0;
|
||||
}
|
||||
|
||||
void WidgetHost::updateFormWindowSelectionHandles(bool active)
|
||||
{
|
||||
Internal::SelectionHandleState state = Internal::SelectionHandleOff;
|
||||
const QDesignerFormWindowCursorInterface *cursor = m_formWindow->cursor();
|
||||
if (cursor->isWidgetSelected(m_formWindow->mainContainer()))
|
||||
state = active ? Internal::SelectionHandleActive : Internal::SelectionHandleInactive;
|
||||
|
||||
m_formResizer->setState(state);
|
||||
}
|
||||
|
||||
QWidget *WidgetHost::integrationContainer() const
|
||||
{
|
||||
return m_formResizer;
|
||||
}
|
80
limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/widgethost.h
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at qt-sales@nokia.com.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef WIDGETHOST_H
|
||||
#define WIDGETHOST_H
|
||||
|
||||
#include "namespace_global.h"
|
||||
|
||||
#include <QScrollArea>
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QDesignerFormWindowInterface)
|
||||
|
||||
namespace SharedTools {
|
||||
|
||||
namespace Internal {
|
||||
class FormResizer;
|
||||
}
|
||||
|
||||
/* A scroll area that embeds a Designer form window */
|
||||
|
||||
class WidgetHost : public QScrollArea
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
WidgetHost(QWidget *parent = 0, QDesignerFormWindowInterface *formWindow = 0);
|
||||
virtual ~WidgetHost();
|
||||
// Show handles if active and main container is selected.
|
||||
void updateFormWindowSelectionHandles(bool active);
|
||||
|
||||
inline QDesignerFormWindowInterface *formWindow() const { return m_formWindow; }
|
||||
|
||||
QWidget *integrationContainer() const;
|
||||
|
||||
protected:
|
||||
void setFormWindow(QDesignerFormWindowInterface *fw);
|
||||
|
||||
signals:
|
||||
void formWindowSizeChanged(int, int);
|
||||
|
||||
private slots:
|
||||
void fwSizeWasChanged(const QRect &, const QRect &);
|
||||
void formWindowDeleted(QObject* object);
|
||||
|
||||
private:
|
||||
QSize formWindowSize() const;
|
||||
|
||||
QDesignerFormWindowInterface *m_formWindow;
|
||||
Internal::FormResizer *m_formResizer;
|
||||
QSize m_oldFakeWidgetSize;
|
||||
};
|
||||
|
||||
} // namespace SharedTools
|
||||
|
||||
#endif // WIDGETHOST_H
|
41
limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/widgethostconstants.h
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at qt-sales@nokia.com.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef WIDGETHOST_CONSTANTS_H
|
||||
#define WIDGETHOST_CONSTANTS_H
|
||||
|
||||
namespace SharedTools {
|
||||
namespace Internal {
|
||||
enum { SELECTION_HANDLE_SIZE = 6, SELECTION_MARGIN = 10 };
|
||||
enum SelectionHandleState { SelectionHandleOff, SelectionHandleInactive, SelectionHandleActive };
|
||||
}
|
||||
}
|
||||
|
||||
#endif // WIDGETHOST_CONSTANTS_H
|
||||
|
48
limereport/dialogdesigner/3rdparty/qtcreator/namespace_global.h
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at qt-sales@nokia.com.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef NAMESPACE_GLOBAL_H
|
||||
#define NAMESPACE_GLOBAL_H
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
|
||||
#if QT_VERSION < 0x040400
|
||||
# define QT_ADD_NAMESPACE(name) ::name
|
||||
# define QT_USE_NAMESPACE
|
||||
# define QT_BEGIN_NAMESPACE
|
||||
# define QT_END_NAMESPACE
|
||||
# define QT_BEGIN_INCLUDE_NAMESPACE
|
||||
# define QT_END_INCLUDE_NAMESPACE
|
||||
# define QT_BEGIN_MOC_NAMESPACE
|
||||
# define QT_END_MOC_NAMESPACE
|
||||
# define QT_FORWARD_DECLARE_CLASS(name) class name;
|
||||
# define QT_MANGLE_NAMESPACE(name) name
|
||||
#endif
|
||||
|
||||
#endif // NAMESPACE_GLOBAL_H
|
27
limereport/dialogdesigner/dialogdesigner.pri
Normal file
@@ -0,0 +1,27 @@
|
||||
include(../../common.pri)
|
||||
include($$PWD/3rdparty/qtcreator/designerintegrationv2/designerintegration.pri)
|
||||
INCLUDEPATH *= $$PWD/3rdparty/designer
|
||||
greaterThan(QT_MAJOR_VERSION, 4) {
|
||||
contains(QT,uitools){
|
||||
DEFINES += HAVE_QTDESIGNER_INTEGRATION
|
||||
}
|
||||
}
|
||||
lessThan(QT_MAJOR_VERSION, 5){
|
||||
contains(CONFIG,uitools){
|
||||
DEFINES += HAVE_QTDESIGNER_INTEGRATION
|
||||
}
|
||||
}
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4) {
|
||||
QT *= designer designercomponents-private
|
||||
|
||||
} else {
|
||||
CONFIG *= designer
|
||||
qtAddLibrary( QtDesignerComponents )
|
||||
}
|
||||
|
||||
SOURCES += $$PWD/lrdialogdesigner.cpp
|
||||
HEADERS += $$PWD/lrdialogdesigner.h
|
||||
|
||||
RESOURCES += \
|
||||
$$PWD/dialogdesigner.qrc
|
12
limereport/dialogdesigner/dialogdesigner.qrc
Normal file
@@ -0,0 +1,12 @@
|
||||
<RCC>
|
||||
<qresource prefix="/images">
|
||||
<file>images/buddytool.png</file>
|
||||
<file>images/editform.png</file>
|
||||
<file>images/signalslottool.png</file>
|
||||
<file>images/tabordertool.png</file>
|
||||
<file>images/widgettool.png</file>
|
||||
</qresource>
|
||||
<qresource prefix="/templates">
|
||||
<file>templates/Dialog.ui</file>
|
||||
</qresource>
|
||||
</RCC>
|
BIN
limereport/dialogdesigner/images/buddytool.png
Normal file
After Width: | Height: | Size: 997 B |
BIN
limereport/dialogdesigner/images/editform.png
Normal file
After Width: | Height: | Size: 349 B |
BIN
limereport/dialogdesigner/images/signalslottool.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
limereport/dialogdesigner/images/tabordertool.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
limereport/dialogdesigner/images/widgettool.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
358
limereport/dialogdesigner/lrdialogdesigner.cpp
Normal file
@@ -0,0 +1,358 @@
|
||||
#include "lrdialogdesigner.h"
|
||||
|
||||
#include <QPluginLoader>
|
||||
|
||||
#include <QDesignerComponents>
|
||||
#include <QDesignerFormEditorInterface>
|
||||
#include <QDesignerFormWindowInterface>
|
||||
#include <QDesignerFormWindowManagerInterface>
|
||||
#include <QDesignerFormEditorPluginInterface>
|
||||
|
||||
#include <QDesignerWidgetBoxInterface>
|
||||
#include <QDesignerActionEditorInterface>
|
||||
#include <QDesignerPropertyEditorInterface>
|
||||
#include <QDesignerObjectInspectorInterface>
|
||||
#include <QDesignerFormEditorInterface>
|
||||
#include <QAction>
|
||||
#include <QDebug>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#if HAVE_QT5
|
||||
#include <QDesignerIntegration>
|
||||
#endif
|
||||
#if HAVE_QT4
|
||||
#include "qdesigner_integration_p.h"
|
||||
#include <QtDesigner/QDesignerIntegrationInterface>
|
||||
#endif
|
||||
#include "pluginmanager_p.h"
|
||||
#include "widgethost.h"
|
||||
#include <abstractobjectinspector.h>
|
||||
|
||||
namespace LimeReport{
|
||||
|
||||
DialogDesignerManager::DialogDesignerManager(QObject *parent) : QObject(parent)
|
||||
{
|
||||
QDesignerComponents::initializeResources();
|
||||
m_formEditor = QDesignerComponents::createFormEditor(this);
|
||||
QDesignerComponents::initializePlugins(m_formEditor);
|
||||
QDesignerComponents::createTaskMenu(m_formEditor, this);
|
||||
|
||||
m_editWidgetsAction = new QAction(tr("Edit Widgets"), this);
|
||||
m_editWidgetsAction->setIcon(QIcon(":/images/images/widgettool.png"));
|
||||
m_editWidgetsAction->setEnabled(false);
|
||||
connect(m_editWidgetsAction, SIGNAL(triggered()), this, SLOT(slotEditWidgets()));
|
||||
connect(m_formEditor->formWindowManager(), SIGNAL(activeFormWindowChanged(QDesignerFormWindowInterface*)),
|
||||
this, SLOT(slotActiveFormWindowChanged(QDesignerFormWindowInterface*)) );
|
||||
|
||||
m_modes = new QActionGroup(this);
|
||||
m_modes->setExclusive(true);
|
||||
m_modes->addAction(m_editWidgetsAction);
|
||||
|
||||
foreach ( QObject* o, QPluginLoader::staticInstances() << m_formEditor->pluginManager()->instances() )
|
||||
{
|
||||
if ( QDesignerFormEditorPluginInterface* fep = qobject_cast<QDesignerFormEditorPluginInterface*>( o ) )
|
||||
{
|
||||
if ( !fep->isInitialized() )
|
||||
fep->initialize( m_formEditor );
|
||||
fep->action()->setCheckable( true );
|
||||
fep->action()->setIcon(QIcon(iconPathByName(fep->action()->objectName())));
|
||||
m_modes->addAction(fep->action());
|
||||
}
|
||||
}
|
||||
|
||||
m_widgetBox = QDesignerComponents::createWidgetBox(m_formEditor, 0);
|
||||
m_widgetBox->setWindowTitle(tr("Widget Box"));
|
||||
m_widgetBox->setObjectName(QLatin1String("WidgetBox"));
|
||||
m_formEditor->setWidgetBox(m_widgetBox);
|
||||
m_formEditor->setTopLevel(m_widgetBox);
|
||||
m_designerToolWindows.append(m_widgetBox);
|
||||
connect(m_widgetBox, SIGNAL(destroyed(QObject*)), this, SLOT(slotObjectDestroyed(QObject*)) );
|
||||
|
||||
m_objectInspector = QDesignerComponents::createObjectInspector(m_formEditor, 0);
|
||||
m_objectInspector->setWindowTitle(tr("Object Inspector"));
|
||||
m_objectInspector->setObjectName(QLatin1String("ObjectInspector"));
|
||||
m_formEditor->setObjectInspector(m_objectInspector);
|
||||
m_designerToolWindows.append(m_objectInspector);
|
||||
connect(m_objectInspector, SIGNAL(destroyed(QObject*)), this, SLOT(slotObjectDestroyed(QObject*)) );
|
||||
|
||||
m_propertyEditor = QDesignerComponents::createPropertyEditor(m_formEditor, 0);
|
||||
m_propertyEditor->setWindowTitle(tr("Property Editor"));
|
||||
m_propertyEditor->setObjectName(QLatin1String("PropertyEditor"));
|
||||
m_formEditor->setPropertyEditor(m_propertyEditor);
|
||||
m_designerToolWindows.append(m_propertyEditor);
|
||||
connect(m_propertyEditor, SIGNAL(destroyed(QObject*)), this, SLOT(slotObjectDestroyed(QObject*)) );
|
||||
|
||||
m_signalSlotEditor = QDesignerComponents::createSignalSlotEditor(m_formEditor, 0);
|
||||
m_signalSlotEditor->setWindowTitle(tr("Signals && Slots Editor"));
|
||||
m_signalSlotEditor->setObjectName(QLatin1String("SignalsAndSlotsEditor"));
|
||||
|
||||
m_designerToolWindows.append(m_signalSlotEditor);
|
||||
connect(m_signalSlotEditor, SIGNAL(destroyed(QObject*)), this, SLOT(slotObjectDestroyed(QObject*)) );
|
||||
|
||||
m_resourcesEditor = QDesignerComponents::createResourceEditor(m_formEditor, 0);
|
||||
m_resourcesEditor->setWindowTitle(tr("Resource Editor"));
|
||||
m_resourcesEditor->setObjectName(QLatin1String("ResourceEditor"));
|
||||
m_designerToolWindows.append(m_resourcesEditor);
|
||||
connect(m_resourcesEditor, SIGNAL(destroyed(QObject*)), this, SLOT(slotObjectDestroyed(QObject*)) );
|
||||
|
||||
m_actionEditor = QDesignerComponents::createActionEditor(m_formEditor, 0);
|
||||
m_actionEditor->setWindowTitle(tr("Action Editor"));
|
||||
m_actionEditor->setObjectName("ActionEditor");
|
||||
m_formEditor->setActionEditor(m_actionEditor);
|
||||
m_designerToolWindows.append(m_actionEditor);
|
||||
connect(m_actionEditor, SIGNAL(destroyed(QObject*)), this, SLOT(slotObjectDestroyed(QObject*)) );
|
||||
|
||||
#ifdef HAVE_QT4
|
||||
m_designerIntegration = new qdesigner_internal::QDesignerIntegration(m_formEditor,this);
|
||||
#endif
|
||||
#ifdef HAVE_QT5
|
||||
m_designerIntegration = new QDesignerIntegration(m_formEditor,this);
|
||||
#endif
|
||||
m_formEditor->setIntegration(m_designerIntegration);
|
||||
|
||||
}
|
||||
|
||||
DialogDesignerManager::~DialogDesignerManager()
|
||||
{
|
||||
for (int i = 0; i<m_designerToolWindows.size();++i){
|
||||
if (m_designerToolWindows[i])
|
||||
delete m_designerToolWindows[i];
|
||||
}
|
||||
|
||||
delete m_designerIntegration;
|
||||
delete m_formEditor;
|
||||
}
|
||||
|
||||
void DialogDesignerManager::initToolBar(QToolBar *tb)
|
||||
{
|
||||
tb->setIconSize(QSize(16,16));
|
||||
m_formEditor->formWindowManager()->actionCopy()->setIcon(QIcon(":/report/images/copy"));
|
||||
tb->addAction(m_formEditor->formWindowManager()->actionCopy());
|
||||
m_formEditor->formWindowManager()->actionPaste()->setIcon(QIcon(":/report/images/paste"));
|
||||
tb->addAction(m_formEditor->formWindowManager()->actionPaste());
|
||||
m_formEditor->formWindowManager()->actionCut()->setIcon(QIcon(":/report/images/cut"));
|
||||
tb->addAction(m_formEditor->formWindowManager()->actionCut());
|
||||
m_formEditor->formWindowManager()->actionUndo()->setIcon(QIcon(":/report/images/undo"));
|
||||
tb->addAction(m_formEditor->formWindowManager()->actionUndo());
|
||||
m_formEditor->formWindowManager()->actionRedo()->setIcon(QIcon(":/report/images/redo"));
|
||||
tb->addAction(m_formEditor->formWindowManager()->actionRedo());
|
||||
|
||||
tb->addActions(m_modes->actions());
|
||||
|
||||
tb->addAction(m_formEditor->formWindowManager()->actionHorizontalLayout());
|
||||
tb->addAction(m_formEditor->formWindowManager()->actionVerticalLayout());
|
||||
tb->addAction(m_formEditor->formWindowManager()->actionSplitHorizontal());
|
||||
tb->addAction(m_formEditor->formWindowManager()->actionSplitVertical());
|
||||
tb->addAction(m_formEditor->formWindowManager()->actionGridLayout());
|
||||
m_formEditor->formWindowManager()->actionFormLayout()->setIcon(QIcon(":/images/images/editform.png"));
|
||||
tb->addAction(m_formEditor->formWindowManager()->actionFormLayout());
|
||||
tb->addAction(m_formEditor->formWindowManager()->actionBreakLayout());
|
||||
tb->addAction(m_formEditor->formWindowManager()->actionAdjustSize());
|
||||
}
|
||||
|
||||
QWidget *DialogDesignerManager::createFormEditor(const QString &content)
|
||||
{
|
||||
QDesignerFormWindowInterface* wnd = m_formEditor->formWindowManager()->createFormWindow(0, Qt::Window);
|
||||
wnd->setContents(content);
|
||||
m_formEditor->formWindowManager()->setActiveFormWindow(wnd);
|
||||
m_formEditor->objectInspector()->setFormWindow(wnd);
|
||||
wnd->editWidgets();
|
||||
|
||||
DialogDesigner* dialogDesigner = new DialogDesigner(wnd, m_formEditor);
|
||||
|
||||
connect(dialogDesigner, SIGNAL(dialogChanged(QString)), this, SIGNAL(dialogChanged(QString)));
|
||||
connect(dialogDesigner, SIGNAL(dialogNameChanged(QString,QString)), this, SIGNAL(dialogNameChanged(QString,QString)));
|
||||
connect(dialogDesigner, SIGNAL(destroyed(QObject*)), this, SLOT(slotObjectDestroyed(QObject*)));
|
||||
|
||||
m_dialogDesigners.append(dialogDesigner);
|
||||
|
||||
return dialogDesigner;
|
||||
|
||||
}
|
||||
|
||||
QByteArray DialogDesignerManager::getDialogDescription(QWidget *form)
|
||||
{
|
||||
QByteArray result;
|
||||
DialogDesigner* dialogDesigner = dynamic_cast<DialogDesigner*>(form);
|
||||
Q_ASSERT(dialogDesigner != NULL);
|
||||
//SharedTools::WidgetHost* wh = dynamic_cast<SharedTools::WidgetHost*>(form);
|
||||
if (dialogDesigner){
|
||||
result = dialogDesigner->dialogContent();
|
||||
//wh->formWindow()->setDirty(false);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void DialogDesignerManager::setActiveEditor(QWidget *widget)
|
||||
{
|
||||
SharedTools::WidgetHost* wh = dynamic_cast<SharedTools::WidgetHost*>(widget);
|
||||
if (wh){
|
||||
m_formEditor->formWindowManager()->setActiveFormWindow(wh->formWindow());
|
||||
}
|
||||
}
|
||||
|
||||
void DialogDesignerManager::setDirty(bool value)
|
||||
{
|
||||
foreach(DialogDesigner* dialogDesigner, m_dialogDesigners){
|
||||
dialogDesigner->setChanged(value);
|
||||
}
|
||||
}
|
||||
|
||||
QWidget* DialogDesignerManager::widgetBox() const
|
||||
{
|
||||
return m_widgetBox;
|
||||
}
|
||||
|
||||
QWidget* DialogDesignerManager::actionEditor() const
|
||||
{
|
||||
return m_actionEditor;
|
||||
}
|
||||
|
||||
QWidget* DialogDesignerManager::propertyEditor() const
|
||||
{
|
||||
return m_propertyEditor;
|
||||
}
|
||||
|
||||
QWidget* DialogDesignerManager::objectInspector() const
|
||||
{
|
||||
return m_objectInspector;
|
||||
}
|
||||
|
||||
QWidget *DialogDesignerManager::signalSlotEditor() const
|
||||
{
|
||||
return m_signalSlotEditor;
|
||||
}
|
||||
|
||||
QWidget *DialogDesignerManager::resourcesEditor() const
|
||||
{
|
||||
return m_resourcesEditor;
|
||||
}
|
||||
|
||||
void DialogDesignerManager::slotObjectDestroyed(QObject* object)
|
||||
{
|
||||
|
||||
QList<DialogDesigner*>::Iterator it = m_dialogDesigners.begin();
|
||||
while(it!=m_dialogDesigners.end()){
|
||||
if (*it == object){
|
||||
it = m_dialogDesigners.erase(it);
|
||||
return;
|
||||
} else {
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
for ( int i = 0; i<m_designerToolWindows.size();++i){
|
||||
m_designerToolWindows[i] = m_designerToolWindows[i] == object ? 0 : m_designerToolWindows[i];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void DialogDesignerManager::slotEditWidgets()
|
||||
{
|
||||
for (int i = 0; i<m_formEditor->formWindowManager()->formWindowCount(); ++i){
|
||||
m_formEditor->formWindowManager()->formWindow(i)->editWidgets();
|
||||
}
|
||||
}
|
||||
|
||||
void DialogDesignerManager::slotActiveFormWindowChanged(QDesignerFormWindowInterface *formWindow)
|
||||
{
|
||||
if (formWindow){
|
||||
m_editWidgetsAction->setEnabled(true);
|
||||
m_activeWindowName = formWindow->objectName();
|
||||
}
|
||||
}
|
||||
|
||||
QString DialogDesignerManager::iconPathByName(const QString &name)
|
||||
{
|
||||
if (name.compare("__qt_edit_signals_slots_action") == 0)
|
||||
return ":/images/images/signalslottool.png";
|
||||
if (name.compare("__qt_edit_buddies_action") == 0)
|
||||
return ":/images/images/buddytool.png";
|
||||
if (name.compare("_qt_edit_tab_order_action") == 0)
|
||||
return ":/images/images/tabordertool.png";
|
||||
return "";
|
||||
}
|
||||
|
||||
DialogDesigner::DialogDesigner(QDesignerFormWindowInterface* wnd, QDesignerFormEditorInterface* formEditor, QWidget *parent, Qt::WindowFlags flags)
|
||||
:QWidget(parent, flags), m_formEditor(formEditor)
|
||||
{
|
||||
m_dialogName = wnd->mainContainer()->objectName();
|
||||
connect(wnd, SIGNAL(changed()), this, SLOT(slotDialogChanged()));
|
||||
|
||||
m_designerHolder = new SharedTools::WidgetHost(this,wnd);
|
||||
m_designerHolder->setFrameStyle( QFrame::NoFrame | QFrame::Plain );
|
||||
m_designerHolder->setFocusProxy( wnd );
|
||||
|
||||
QVBoxLayout* l = new QVBoxLayout(this);
|
||||
l->addWidget(m_designerHolder);
|
||||
setLayout(l);
|
||||
|
||||
}
|
||||
|
||||
DialogDesigner::~DialogDesigner(){}
|
||||
|
||||
QString DialogDesigner::dialogName() const
|
||||
{
|
||||
return m_dialogName;
|
||||
}
|
||||
|
||||
void DialogDesigner::setDialogName(const QString &dialogName)
|
||||
{
|
||||
m_dialogName = dialogName;
|
||||
}
|
||||
|
||||
bool DialogDesigner::isChanged()
|
||||
{
|
||||
return m_designerHolder->formWindow()->isDirty();
|
||||
}
|
||||
|
||||
void DialogDesigner::setChanged(bool value)
|
||||
{
|
||||
m_designerHolder->formWindow()->setDirty(value);
|
||||
}
|
||||
|
||||
QByteArray DialogDesigner::dialogContent()
|
||||
{
|
||||
if (m_designerHolder && m_designerHolder->formWindow())
|
||||
return m_designerHolder->formWindow()->contents().toUtf8();
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
void DialogDesigner::undo()
|
||||
{
|
||||
Q_ASSERT(m_formEditor != NULL);
|
||||
if (m_formEditor){
|
||||
m_formEditor->formWindowManager()->actionUndo()->trigger();
|
||||
}
|
||||
}
|
||||
|
||||
void DialogDesigner::redo()
|
||||
{
|
||||
Q_ASSERT(m_formEditor != NULL);
|
||||
if (m_formEditor){
|
||||
m_formEditor->formWindowManager()->actionRedo()->trigger();
|
||||
}
|
||||
}
|
||||
|
||||
void DialogDesigner::slotMainContainerNameChanged(QString newName)
|
||||
{
|
||||
if (m_dialogName.compare(newName) != 0){
|
||||
emit dialogNameChanged(m_dialogName, newName);
|
||||
m_dialogName = newName;
|
||||
}
|
||||
}
|
||||
|
||||
void DialogDesigner::slotDialogChanged()
|
||||
{
|
||||
Q_ASSERT(m_designerHolder != NULL);
|
||||
if (m_designerHolder && m_designerHolder->formWindow()){
|
||||
if ( m_designerHolder->formWindow()->mainContainer()->objectName().compare(m_dialogName) !=0 ){
|
||||
emit dialogNameChanged(m_dialogName, m_designerHolder->formWindow()->mainContainer()->objectName());
|
||||
m_dialogName = m_designerHolder->formWindow()->mainContainer()->objectName();
|
||||
}
|
||||
emit dialogChanged(m_dialogName);
|
||||
m_designerHolder->formWindow()->setDirty(false);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
93
limereport/dialogdesigner/lrdialogdesigner.h
Normal file
@@ -0,0 +1,93 @@
|
||||
#ifndef DIALOGDESIGNER_H
|
||||
#define DIALOGDESIGNER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QVector>
|
||||
#include <QToolBar>
|
||||
#include <QActionGroup>
|
||||
|
||||
class QDesignerFormEditorInterface;
|
||||
class QDesignerFormWindowInterface;
|
||||
class QDesignerIntegrationInterface;
|
||||
class QDesignerWidgetBoxInterface;
|
||||
class QDesignerActionEditorInterface;
|
||||
class QDesignerPropertyEditorInterface;
|
||||
class QDesignerObjectInspectorInterface;
|
||||
class QDesignerFormWindowManagerInterface;
|
||||
|
||||
namespace SharedTools{
|
||||
class WidgetHost;
|
||||
}
|
||||
|
||||
namespace LimeReport{
|
||||
|
||||
class DialogDesigner : public QWidget{
|
||||
Q_OBJECT
|
||||
public:
|
||||
DialogDesigner(QDesignerFormWindowInterface *wnd, QDesignerFormEditorInterface* formEditor, QWidget *parent = NULL, Qt::WindowFlags flags = Qt::WindowFlags());
|
||||
~DialogDesigner();
|
||||
QString dialogName() const;
|
||||
void setDialogName(const QString &dialogName);
|
||||
bool isChanged();
|
||||
void setChanged(bool value);
|
||||
QByteArray dialogContent();
|
||||
public slots:
|
||||
void undo();
|
||||
void redo();
|
||||
signals:
|
||||
void dialogChanged(QString dialogName);
|
||||
void dialogNameChanged(QString oldName, QString newName);
|
||||
private slots:
|
||||
void slotMainContainerNameChanged(QString newName);
|
||||
void slotDialogChanged();
|
||||
private:
|
||||
QString m_dialogName;
|
||||
SharedTools::WidgetHost* m_designerHolder;
|
||||
QDesignerFormEditorInterface* m_formEditor;
|
||||
};
|
||||
|
||||
class DialogDesignerManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit DialogDesignerManager(QObject *parent = 0);
|
||||
~DialogDesignerManager();
|
||||
void initToolBar(QToolBar* tb);
|
||||
QWidget* createFormEditor(const QString& content);
|
||||
QByteArray getDialogDescription(QWidget* form);
|
||||
void setActiveEditor(QWidget* widget);
|
||||
void setDirty(bool value);
|
||||
QWidget* widgetBox() const;
|
||||
QWidget* actionEditor() const;
|
||||
QWidget* propertyEditor() const;
|
||||
QWidget* objectInspector() const;
|
||||
QWidget* signalSlotEditor() const;
|
||||
QWidget* resourcesEditor() const;
|
||||
signals:
|
||||
void dialogChanged(QString dialogName);
|
||||
void dialogNameChanged(QString oldName, QString newName);
|
||||
private slots:
|
||||
void slotObjectDestroyed(QObject* object);
|
||||
void slotEditWidgets();
|
||||
void slotActiveFormWindowChanged(QDesignerFormWindowInterface *formWindow);
|
||||
private:
|
||||
QString iconPathByName(const QString& name);
|
||||
private:
|
||||
QDesignerFormEditorInterface* m_formEditor;
|
||||
QDesignerIntegrationInterface* m_designerIntegration;
|
||||
QDesignerWidgetBoxInterface* m_widgetBox;
|
||||
QDesignerActionEditorInterface* m_actionEditor;
|
||||
QDesignerPropertyEditorInterface* m_propertyEditor;
|
||||
QDesignerObjectInspectorInterface* m_objectInspector;
|
||||
QWidget* m_signalSlotEditor;
|
||||
QWidget* m_resourcesEditor;
|
||||
QVector<QWidget*> m_designerToolWindows;
|
||||
QAction* m_editWidgetsAction;
|
||||
QActionGroup* m_modes;
|
||||
QString m_activeWindowName;
|
||||
QList<DialogDesigner*> m_dialogDesigners;
|
||||
};
|
||||
|
||||
} // namespace LimeReport
|
||||
|
||||
#endif // DIALOGDESIGNER_H
|
18
limereport/dialogdesigner/templates/Dialog.ui
Normal file
@@ -0,0 +1,18 @@
|
||||
<ui version="4.0" >
|
||||
<class>$ClassName$</class>
|
||||
<widget class="QDialog" name="$ClassName$" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>$ClassName$</string>
|
||||
</property>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
Before Width: | Height: | Size: 450 B After Width: | Height: | Size: 205 B |
BIN
limereport/images/addBand2.png
Normal file
After Width: | Height: | Size: 229 B |
BIN
limereport/images/addDialog.png
Normal file
After Width: | Height: | Size: 332 B |
BIN
limereport/images/copy3.png
Normal file
After Width: | Height: | Size: 778 B |
BIN
limereport/images/delete2.png
Normal file
After Width: | Height: | Size: 460 B |
BIN
limereport/images/deleteDialog.png
Normal file
After Width: | Height: | Size: 245 B |
BIN
limereport/images/edit_control_4_24.png
Normal file
After Width: | Height: | Size: 290 B |
BIN
limereport/images/hlayuot_4_24.png
Normal file
After Width: | Height: | Size: 210 B |
BIN
limereport/images/logo_32x32_1.png
Normal file
After Width: | Height: | Size: 591 B |
BIN
limereport/images/paste2.png
Normal file
After Width: | Height: | Size: 749 B |
Before Width: | Height: | Size: 868 B After Width: | Height: | Size: 536 B |
Before Width: | Height: | Size: 591 B After Width: | Height: | Size: 334 B |
Before Width: | Height: | Size: 518 B After Width: | Height: | Size: 295 B |
Before Width: | Height: | Size: 505 B After Width: | Height: | Size: 302 B |
Before Width: | Height: | Size: 634 B After Width: | Height: | Size: 359 B |
Before Width: | Height: | Size: 503 B After Width: | Height: | Size: 297 B |
Before Width: | Height: | Size: 504 B After Width: | Height: | Size: 299 B |
Before Width: | Height: | Size: 459 B After Width: | Height: | Size: 239 B |
Before Width: | Height: | Size: 453 B After Width: | Height: | Size: 235 B |
Before Width: | Height: | Size: 516 B After Width: | Height: | Size: 292 B |
Before Width: | Height: | Size: 518 B After Width: | Height: | Size: 297 B |
Before Width: | Height: | Size: 845 B After Width: | Height: | Size: 564 B |
Before Width: | Height: | Size: 849 B After Width: | Height: | Size: 484 B |
BIN
limereport/items/images/barcode4.png
Normal file
After Width: | Height: | Size: 171 B |
BIN
limereport/items/images/barcode5.png
Normal file
After Width: | Height: | Size: 221 B |
BIN
limereport/items/images/imageItem4.png
Normal file
After Width: | Height: | Size: 259 B |
Before Width: | Height: | Size: 409 B After Width: | Height: | Size: 226 B |
BIN
limereport/items/images/shapes7.png
Normal file
After Width: | Height: | Size: 648 B |
@@ -11,10 +11,10 @@
|
||||
<file>images/insert-text_5.png</file>
|
||||
<file>images/shape5.png</file>
|
||||
<file>images/imageItem1.png</file>
|
||||
<file alias="ImageItem">images/imageItem2.png</file>
|
||||
<file>images/imageItem2.png</file>
|
||||
<file>images/settings.png</file>
|
||||
<file>images/settings2.png</file>
|
||||
<file alias="HorizontalLayout">images/hlayuot_3_24.png</file>
|
||||
<file>images/hlayuot_3_24.png</file>
|
||||
<file alias="Band">images/addBand1.png</file>
|
||||
<file>images/DataBand.png</file>
|
||||
<file>images/PageHeader.png</file>
|
||||
@@ -34,9 +34,13 @@
|
||||
<file alias="GroupBandHeader">images/GroupHeader16.png</file>
|
||||
<file alias="PageItemDesignIntf">images/ReportPage16.png</file>
|
||||
<file alias="TextItem">images/insert-text_6.png</file>
|
||||
<file alias="BarcodeItem">images/barcode3.png</file>
|
||||
<file alias="ShapeItem">images/shape6.png</file>
|
||||
<file alias="ImageItem">images/imageItem3.png</file>
|
||||
<file>images/barcode3.png</file>
|
||||
<file>images/shape6.png</file>
|
||||
<file>images/imageItem3.png</file>
|
||||
<file>images/barcode4.png</file>
|
||||
<file alias="ImageItem">images/imageItem4.png</file>
|
||||
<file alias="ShapeItem">images/shapes7.png</file>
|
||||
<file alias="BarcodeItem">images/barcode5.png</file>
|
||||
<file alias="ChartItem">images/pie_chart2.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
@@ -43,7 +43,7 @@ class AlignmentPropItem : public ObjectPropItem
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
AlignmentPropItem():ObjectPropItem(){}
|
||||
AlignmentPropItem():ObjectPropItem(),m_horizEditor(NULL),m_vertEditor(NULL){}
|
||||
AlignmentPropItem(QObject *object, ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& value, ObjectPropItem* parent, bool readonly=true);
|
||||
QString displayValue() const;
|
||||
void setPropertyValue(QVariant value);
|
||||
|
@@ -390,8 +390,8 @@ void HorizontalLayout::slotOnChildDestroy(QObject* child)
|
||||
BaseDesignIntf* HorizontalLayout::findNext(BaseDesignIntf* item){
|
||||
if (m_children.count()<childItems().size()-1){
|
||||
m_children.clear();
|
||||
foreach (BaseDesignIntf* item, childBaseItems()) {
|
||||
m_children.append(item);
|
||||
foreach (BaseDesignIntf* childItem, childBaseItems()) {
|
||||
m_children.append(childItem);
|
||||
}
|
||||
}
|
||||
qSort(m_children.begin(),m_children.end(),lessThen);
|
||||
@@ -404,8 +404,8 @@ BaseDesignIntf* HorizontalLayout::findNext(BaseDesignIntf* item){
|
||||
BaseDesignIntf* HorizontalLayout::findPrior(BaseDesignIntf* item){
|
||||
if (m_children.count()<childItems().size()-1){
|
||||
m_children.clear();
|
||||
foreach (BaseDesignIntf* item, childBaseItems()) {
|
||||
m_children.append(item);
|
||||
foreach (BaseDesignIntf* childItem, childBaseItems()) {
|
||||
m_children.append(childItem);
|
||||
}
|
||||
}
|
||||
qSort(m_children.begin(),m_children.end(),lessThen);
|
||||
|
@@ -56,16 +56,21 @@ BaseDesignIntf *ImageItem::createSameTypeItem(QObject *owner, QGraphicsItem *par
|
||||
|
||||
void ImageItem::updateItemSize(DataSourceManager* dataManager, RenderPass pass, int maxHeight)
|
||||
{
|
||||
if (!m_datasource.isEmpty() && !m_field.isEmpty() && m_picture.isNull()){
|
||||
IDataSource* ds = dataManager->dataSource(m_datasource);
|
||||
if (ds) {
|
||||
QVariant data = ds->data(m_field);
|
||||
if (data.isValid()){
|
||||
if (data.type()==QVariant::Image){
|
||||
m_picture = data.value<QImage>();
|
||||
} else
|
||||
m_picture.loadFromData(data.toByteArray());
|
||||
}
|
||||
|
||||
if (m_picture.isNull()){
|
||||
if (!m_datasource.isEmpty() && !m_field.isEmpty()){
|
||||
IDataSource* ds = dataManager->dataSource(m_datasource);
|
||||
if (ds) {
|
||||
QVariant data = ds->data(m_field);
|
||||
if (data.isValid()){
|
||||
if (data.type()==QVariant::Image){
|
||||
m_picture = data.value<QImage>();
|
||||
} else
|
||||
m_picture.loadFromData(data.toByteArray());
|
||||
}
|
||||
}
|
||||
} else if (!m_resourcePath.isEmpty()){
|
||||
m_picture = QImage(m_resourcePath);
|
||||
}
|
||||
}
|
||||
if (m_autoSize){
|
||||
@@ -80,6 +85,11 @@ bool ImageItem::isNeedUpdateSize(RenderPass) const
|
||||
return m_picture.isNull() || m_autoSize;
|
||||
}
|
||||
|
||||
QString ImageItem::resourcePath() const
|
||||
{
|
||||
return m_resourcePath;
|
||||
}
|
||||
|
||||
qreal ImageItem::minHeight() const{
|
||||
if (!m_picture.isNull() && autoSize())
|
||||
{
|
||||
@@ -231,6 +241,7 @@ void ImageItem::paint(QPainter *ppainter, const QStyleOptionGraphicsItem *option
|
||||
if (img.isNull() && itemMode()==DesignMode){
|
||||
QString text;
|
||||
ppainter->setFont(transformToSceneFont(QFont("Arial",10)));
|
||||
ppainter->setPen(Qt::black);
|
||||
if (!datasource().isEmpty() && !field().isEmpty())
|
||||
text = datasource()+"."+field();
|
||||
else text = tr("Image");
|
||||
|
@@ -44,12 +44,14 @@ class ImageItem : public LimeReport::ItemDesignIntf
|
||||
Q_PROPERTY(bool scale READ scale WRITE setScale)
|
||||
Q_PROPERTY(bool keepAspectRatio READ keepAspectRatio WRITE setKeepAspectRatio)
|
||||
Q_PROPERTY(bool center READ center WRITE setCenter)
|
||||
Q_PROPERTY(QString resourcePath READ resourcePath WRITE setResourcePath)
|
||||
public:
|
||||
ImageItem(QObject *owner, QGraphicsItem *parent);
|
||||
virtual void paint(QPainter *ppainter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
||||
void setImage(QImage value);
|
||||
QImage image(){return m_picture;}
|
||||
void setContent(const QString &value){m_content=value;}
|
||||
void setResourcePath(const QString &value){m_resourcePath=value;}
|
||||
QString resourcePath() const;
|
||||
QString datasource() const;
|
||||
void setDatasource(const QString &datasource);
|
||||
QString field() const;
|
||||
@@ -72,8 +74,8 @@ protected:
|
||||
bool isNeedUpdateSize(RenderPass) const;
|
||||
bool drawDesignBorders() const {return m_picture.isNull();}
|
||||
private:
|
||||
QImage m_picture;
|
||||
QString m_content;
|
||||
QImage m_picture;
|
||||
QString m_resourcePath;
|
||||
QString m_datasource;
|
||||
QString m_field;
|
||||
bool m_autoSize;
|
||||
|
@@ -85,7 +85,7 @@ void ShapeItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||
pen.setStyle(m_penStyle);
|
||||
painter->setPen(pen);
|
||||
QBrush brush(m_shapeBrushColor,m_shapeBrushType);
|
||||
|
||||
brush.setTransform(painter->worldTransform().inverted());
|
||||
painter->setBrush(brush);
|
||||
painter->setBackground(QBrush(Qt::NoBrush));
|
||||
painter->setOpacity(qreal(m_opacity)/100);
|
||||
|
@@ -63,7 +63,7 @@ QString HtmlContext::parseTag(QVector<Tag *> &storage, QString text, int &curPos
|
||||
tagName.remove('>');
|
||||
|
||||
while (buff.contains(rx)){
|
||||
int pos=rx.indexIn(buff);
|
||||
pos=rx.indexIn(buff);
|
||||
buff=buff.right(buff.length()-pos);
|
||||
curPos+=pos;
|
||||
if (extractWord(rx.cap(0),1).compare(extractWord(tagName,1),Qt::CaseInsensitive)==0){
|
||||
|
@@ -31,6 +31,7 @@
|
||||
#include <QTextLayout>
|
||||
#include <QtScript/QScriptEngine>
|
||||
#include <QLocale>
|
||||
#include <QMessageBox>
|
||||
#include <math.h>
|
||||
|
||||
#include "lrpagedesignintf.h"
|
||||
@@ -41,6 +42,7 @@
|
||||
#include "lrsimpletagparser.h"
|
||||
#include "lrtextitemeditor.h"
|
||||
#include "lrreportengine_p.h"
|
||||
#include <QMenu>
|
||||
|
||||
namespace{
|
||||
|
||||
@@ -57,10 +59,8 @@ namespace LimeReport{
|
||||
|
||||
TextItem::TextItem(QObject *owner, QGraphicsItem *parent)
|
||||
: ContentItemDesignIntf(xmlTag,owner,parent), m_angle(Angle0), m_trimValue(true), m_allowHTML(false),
|
||||
m_allowHTMLInFields(false)
|
||||
m_allowHTMLInFields(false), m_followTo(""), m_follower(0), m_textIndent(0), m_textLayoutDirection(Qt::LayoutDirectionAuto)
|
||||
{
|
||||
m_text = new QTextDocument();
|
||||
|
||||
PageItemDesignIntf* pageItem = dynamic_cast<PageItemDesignIntf*>(parent);
|
||||
BaseDesignIntf* parentItem = dynamic_cast<BaseDesignIntf*>(parent);
|
||||
while (!pageItem && parentItem){
|
||||
@@ -75,25 +75,81 @@ TextItem::TextItem(QObject *owner, QGraphicsItem *parent)
|
||||
Init();
|
||||
}
|
||||
|
||||
TextItem::~TextItem()
|
||||
{
|
||||
delete m_text;
|
||||
TextItem::~TextItem(){}
|
||||
|
||||
int TextItem::fakeMarginSize() const{
|
||||
return marginSize()+5;
|
||||
}
|
||||
|
||||
int TextItem::fakeMarginSize(){
|
||||
return marginSize()+5;
|
||||
void TextItem::preparePopUpMenu(QMenu &menu)
|
||||
{
|
||||
QAction* editAction = menu.addAction(QIcon(":/report/images/edit_pecil2.png"),tr("Edit"));
|
||||
menu.insertAction(menu.actions().at(0),editAction);
|
||||
menu.insertSeparator(menu.actions().at(1));
|
||||
|
||||
menu.addSeparator();
|
||||
|
||||
QAction* action = menu.addAction(tr("Auto height"));
|
||||
action->setCheckable(true);
|
||||
action->setChecked(autoHeight());
|
||||
|
||||
action = menu.addAction(tr("Allow HTML"));
|
||||
action->setCheckable(true);
|
||||
action->setChecked(allowHTML());
|
||||
|
||||
action = menu.addAction(tr("Allow HTML in fields"));
|
||||
action->setCheckable(true);
|
||||
action->setChecked(allowHTMLInFields());
|
||||
|
||||
action = menu.addAction(tr("Stretch to max height"));
|
||||
action->setCheckable(true);
|
||||
action->setChecked(stretchToMaxHeight());
|
||||
|
||||
action = menu.addAction(tr("Transparent"));
|
||||
action->setCheckable(true);
|
||||
action->setChecked(backgroundMode() == TransparentMode);
|
||||
|
||||
}
|
||||
|
||||
void TextItem::processPopUpAction(QAction *action)
|
||||
{
|
||||
if (action->text().compare(tr("Edit")) == 0){
|
||||
this->showEditorDialog();
|
||||
}
|
||||
if (action->text().compare(tr("Auto height")) == 0){
|
||||
setProperty("autoHeight",action->isChecked());
|
||||
}
|
||||
if (action->text().compare(tr("Allow HTML")) == 0){
|
||||
setProperty("allowHTML",action->isChecked());
|
||||
}
|
||||
if (action->text().compare(tr("Allow HTML in fields")) == 0){
|
||||
setProperty("allowHTMLInFields",action->isChecked());
|
||||
}
|
||||
if (action->text().compare(tr("Stretch to max height")) == 0){
|
||||
setProperty("stretchToMaxHeight",action->isChecked());
|
||||
}
|
||||
if (action->text().compare(tr("Transparent")) == 0){
|
||||
if (action->isChecked()){
|
||||
setProperty("backgroundMode",TransparentMode);
|
||||
} else {
|
||||
setProperty("backgroundMode",OpaqueMode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TextItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* style, QWidget* widget) {
|
||||
Q_UNUSED(widget);
|
||||
Q_UNUSED(style);
|
||||
|
||||
|
||||
TextPtr text = textDocument();
|
||||
|
||||
painter->save();
|
||||
|
||||
setupPainter(painter);
|
||||
prepareRect(painter,style,widget);
|
||||
|
||||
QSizeF tmpSize = rect().size()-m_textSize;
|
||||
QSizeF tmpSize = rect().size()-text->size();
|
||||
|
||||
if (!painter->clipRegion().isEmpty()){
|
||||
QRegion clipReg=painter->clipRegion().xored(painter->clipRegion().subtracted(rect().toRect()));
|
||||
@@ -102,38 +158,38 @@ void TextItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* style, Q
|
||||
painter->setClipRect(rect());
|
||||
}
|
||||
|
||||
qreal hOffset = 0, vOffset=0;
|
||||
qreal hOffset = 0, vOffset = 0;
|
||||
switch (m_angle){
|
||||
case Angle0:
|
||||
hOffset = fakeMarginSize();
|
||||
if ((tmpSize.height()>0) && (m_alignment & Qt::AlignVCenter)){
|
||||
vOffset = tmpSize.height()/2;
|
||||
if ((tmpSize.height() > 0) && (m_alignment & Qt::AlignVCenter)){
|
||||
vOffset = tmpSize.height() / 2;
|
||||
}
|
||||
if ((tmpSize.height()>0) && (m_alignment & Qt::AlignBottom)) // allow html
|
||||
if ((tmpSize.height() > 0) && (m_alignment & Qt::AlignBottom)) // allow html
|
||||
vOffset = tmpSize.height();
|
||||
painter->translate(hOffset,vOffset);
|
||||
break;
|
||||
case Angle90:
|
||||
hOffset = width()-fakeMarginSize();
|
||||
hOffset = width() - fakeMarginSize();
|
||||
vOffset = fakeMarginSize();
|
||||
if (m_alignment & Qt::AlignVCenter){
|
||||
hOffset = (width()-m_text->size().height())/2+m_text->size().height();
|
||||
hOffset = (width() - text->size().height()) / 2 + text->size().height();
|
||||
}
|
||||
|
||||
if (m_alignment & Qt::AlignBottom){
|
||||
hOffset = (m_text->size().height());
|
||||
hOffset = (text->size().height());
|
||||
}
|
||||
painter->translate(hOffset,vOffset);
|
||||
painter->rotate(90);
|
||||
break;
|
||||
case Angle180:
|
||||
hOffset = width()-fakeMarginSize();
|
||||
vOffset = height()-fakeMarginSize();
|
||||
hOffset = width() - fakeMarginSize();
|
||||
vOffset = height() - fakeMarginSize();
|
||||
if ((tmpSize.width()>0) && (m_alignment & Qt::AlignVCenter)){
|
||||
vOffset = tmpSize.height()/2+m_text->size().height();
|
||||
vOffset = tmpSize.height() / 2+ text->size().height();
|
||||
}
|
||||
if ((tmpSize.height()>0) && (m_alignment & Qt::AlignBottom)){
|
||||
vOffset = (m_text->size().height());
|
||||
vOffset = (text->size().height());
|
||||
}
|
||||
painter->translate(hOffset,vOffset);
|
||||
painter->rotate(180);
|
||||
@@ -142,11 +198,11 @@ void TextItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* style, Q
|
||||
hOffset = fakeMarginSize();
|
||||
vOffset = height()-fakeMarginSize();
|
||||
if (m_alignment & Qt::AlignVCenter){
|
||||
hOffset = (width()-m_text->size().height())/2;
|
||||
hOffset = (width() - text->size().height())/2;
|
||||
}
|
||||
|
||||
if (m_alignment & Qt::AlignBottom){
|
||||
hOffset = (width()-m_text->size().height());
|
||||
hOffset = (width() - text->size().height());
|
||||
}
|
||||
painter->translate(hOffset,vOffset);
|
||||
painter->rotate(270);
|
||||
@@ -154,12 +210,12 @@ void TextItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* style, Q
|
||||
case Angle45:
|
||||
painter->translate(width()/2,0);
|
||||
painter->rotate(45);
|
||||
m_text->setTextWidth(sqrt(2*(pow(width()/2,2))));
|
||||
text->setTextWidth(sqrt(2*(pow(width()/2,2))));
|
||||
break;
|
||||
case Angle315:
|
||||
painter->translate(0,height()/2);
|
||||
painter->rotate(315);
|
||||
m_text->setTextWidth(sqrt(2*(pow(height()/2,2))));
|
||||
text->setTextWidth(sqrt(2*(pow(height()/2,2))));
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -175,7 +231,8 @@ void TextItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* style, Q
|
||||
painter->setOpacity(qreal(foregroundOpacity())/100);
|
||||
QAbstractTextDocumentLayout::PaintContext ctx;
|
||||
ctx.palette.setColor(QPalette::Text, fontColor());
|
||||
for(QTextBlock it=m_text->begin();it!=m_text->end();it=it.next()){
|
||||
|
||||
for(QTextBlock it = text->begin(); it != text->end(); it=it.next()){
|
||||
it.blockFormat().setLineHeight(m_lineSpacing,QTextBlockFormat::LineDistanceHeight);
|
||||
for (int i=0;i<it.layout()->lineCount();i++){
|
||||
QTextLine line = it.layout()->lineAt(i);
|
||||
@@ -186,7 +243,8 @@ void TextItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* style, Q
|
||||
}
|
||||
}
|
||||
}
|
||||
m_text->documentLayout()->draw(painter,ctx);
|
||||
|
||||
text->documentLayout()->draw(painter,ctx);
|
||||
|
||||
if (m_underlines){
|
||||
if (lineHeight<0) lineHeight = painter->fontMetrics().height();
|
||||
@@ -195,19 +253,6 @@ void TextItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* style, Q
|
||||
}
|
||||
}
|
||||
|
||||
//painter->setOpacity(qreal(foregroundOpacity())/100);
|
||||
|
||||
//m_text->setDefaultTextOption();
|
||||
//QAbstractTextDocumentLayout::PaintContext ctx;
|
||||
//ctx.palette.setColor(QPalette::Text, fontColor());
|
||||
//m_text->documentLayout()->draw(painter,ctx);
|
||||
|
||||
// m_layout.draw(ppainter,QPointF(marginSize(),0),);
|
||||
// ppainter->setFont(transformToSceneFont(font()));
|
||||
// QTextOption o;
|
||||
// o.setAlignment(alignment());
|
||||
// ppainter->drawText(rect(), content(), o);
|
||||
|
||||
painter->restore();
|
||||
BaseDesignIntf::paint(painter, style, widget);
|
||||
}
|
||||
@@ -218,11 +263,11 @@ QString TextItem::content() const{
|
||||
|
||||
void TextItem::Init()
|
||||
{
|
||||
m_autoWidth=NoneAutoWidth;
|
||||
m_alignment= Qt::AlignLeft|Qt::AlignTop;
|
||||
m_autoHeight=false;
|
||||
// m_text->setDefaultFont(transformToSceneFont(font()));
|
||||
m_textSize=QSizeF();
|
||||
m_autoWidth = NoneAutoWidth;
|
||||
m_alignment = Qt::AlignLeft|Qt::AlignTop;
|
||||
m_autoHeight = false;
|
||||
m_textSize = QSizeF();
|
||||
m_firstLineSize = 0;
|
||||
m_foregroundOpacity = 100;
|
||||
m_underlines = false;
|
||||
m_adaptFontToSize = false;
|
||||
@@ -235,19 +280,18 @@ void TextItem::setContent(const QString &value)
|
||||
{
|
||||
if (m_strText.compare(value)!=0){
|
||||
QString oldValue = m_strText;
|
||||
m_strText=value;
|
||||
if (allowHTML())
|
||||
m_text->setHtml(replaceReturns(value.trimmed()));
|
||||
if (m_trimValue)
|
||||
m_strText=value.trimmed();
|
||||
else
|
||||
m_text->setPlainText(value);
|
||||
//m_text->setTextWidth(width());
|
||||
//m_textSize=m_text->size();
|
||||
if (itemMode() == DesignMode){
|
||||
initText();
|
||||
}
|
||||
m_strText=value;
|
||||
|
||||
// if (itemMode() == DesignMode && (autoHeight())){
|
||||
// initTextSizes();
|
||||
// }
|
||||
|
||||
if (!isLoading()){
|
||||
initText();
|
||||
if (autoHeight() || autoWidth() || hasFollower())
|
||||
initTextSizes();
|
||||
update(rect());
|
||||
notify("content",oldValue,value);
|
||||
}
|
||||
@@ -258,15 +302,20 @@ void TextItem::updateItemSize(DataSourceManager* dataManager, RenderPass pass, i
|
||||
{
|
||||
if (isNeedExpandContent())
|
||||
expandContent(dataManager, pass);
|
||||
if (!isLoading())
|
||||
initText();
|
||||
if (!isLoading() && (autoHeight() || autoWidth() || hasFollower()) )
|
||||
initTextSizes();
|
||||
|
||||
if (m_textSize.width()>width() && ((m_autoWidth==MaxWordLength)||(m_autoWidth==MaxStringLength))){
|
||||
setWidth(m_textSize.width() + fakeMarginSize()*2);
|
||||
}
|
||||
|
||||
if ((m_textSize.height()>height()) && (m_autoHeight) ){
|
||||
setHeight(m_textSize.height()+borderLineSize()*2);
|
||||
if (m_textSize.height()>height()) {
|
||||
if (m_autoHeight)
|
||||
setHeight(m_textSize.height()+borderLineSize()*2);
|
||||
else if (hasFollower() && !content().isEmpty()){
|
||||
follower()->setContent(getTextPart(0,height()));
|
||||
setContent(getTextPart(height(),0));
|
||||
}
|
||||
}
|
||||
BaseDesignIntf::updateItemSize(dataManager, pass, maxHeight);
|
||||
}
|
||||
@@ -305,24 +354,25 @@ QString TextItem::replaceReturns(QString text)
|
||||
return result;
|
||||
}
|
||||
|
||||
void TextItem::setTextFont(const QFont& value){
|
||||
m_text->setDefaultFont(value);
|
||||
void TextItem::setTextFont(TextPtr text, const QFont& value) const {
|
||||
text->setDefaultFont(value);
|
||||
if ((m_angle==Angle0)||(m_angle==Angle180)){
|
||||
m_text->setTextWidth(rect().width()-fakeMarginSize()*2);
|
||||
text->setTextWidth(rect().width()-fakeMarginSize()*2);
|
||||
} else {
|
||||
m_text->setTextWidth(rect().height()-fakeMarginSize()*2);
|
||||
text->setTextWidth(rect().height()-fakeMarginSize()*2);
|
||||
}
|
||||
}
|
||||
|
||||
void TextItem::adaptFontSize(){
|
||||
void TextItem::adaptFontSize(TextPtr text) const{
|
||||
QFont _font = transformToSceneFont(font());
|
||||
do{
|
||||
setTextFont(_font);
|
||||
setTextFont(text,_font);
|
||||
if (_font.pixelSize()>2)
|
||||
_font.setPixelSize(_font.pixelSize()-1);
|
||||
else break;
|
||||
} while(m_text->size().height()>this->height() || m_text->size().width()>(this->width())-fakeMarginSize()*2);
|
||||
} while(text->size().height()>this->height() || text->size().width()>(this->width()) - fakeMarginSize() * 2);
|
||||
}
|
||||
|
||||
int TextItem::underlineLineSize() const
|
||||
{
|
||||
return m_underlineLineSize;
|
||||
@@ -345,52 +395,19 @@ void TextItem::setLineSpacing(int value)
|
||||
{
|
||||
int oldValue = m_lineSpacing;
|
||||
m_lineSpacing = value;
|
||||
initText();
|
||||
// if (autoHeight())
|
||||
// initTextSizes();
|
||||
update();
|
||||
notify("lineSpacing",oldValue,value);
|
||||
}
|
||||
|
||||
|
||||
void TextItem::initText()
|
||||
void TextItem::initTextSizes() const
|
||||
{
|
||||
QTextOption to;
|
||||
to.setAlignment(m_alignment);
|
||||
|
||||
if (m_autoWidth!=MaxStringLength)
|
||||
if (m_adaptFontToSize && (!(m_autoHeight || m_autoWidth)))
|
||||
to.setWrapMode(QTextOption::WordWrap);
|
||||
else
|
||||
to.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
|
||||
else to.setWrapMode(QTextOption::NoWrap);
|
||||
|
||||
m_text->setDocumentMargin(0);
|
||||
m_text->setDefaultTextOption(to);
|
||||
|
||||
QFont _font = transformToSceneFont(font());
|
||||
if (m_adaptFontToSize && (!(m_autoHeight || m_autoWidth))){
|
||||
adaptFontSize();
|
||||
} else {
|
||||
setTextFont(transformToSceneFont(font()));
|
||||
}
|
||||
|
||||
if ((m_angle==Angle0)||(m_angle==Angle180)){
|
||||
m_text->setTextWidth(rect().width()-fakeMarginSize()*2);
|
||||
} else {
|
||||
m_text->setTextWidth(rect().height()-fakeMarginSize()*2);
|
||||
}
|
||||
|
||||
for ( QTextBlock block = m_text->begin(); block.isValid(); block = block.next())
|
||||
{
|
||||
QTextCursor tc = QTextCursor(block);
|
||||
QTextBlockFormat fmt = block.blockFormat();
|
||||
|
||||
if(fmt.lineHeight() != m_lineSpacing) {
|
||||
fmt.setLineHeight(m_lineSpacing,QTextBlockFormat::LineDistanceHeight);
|
||||
tc.setBlockFormat( fmt );
|
||||
}
|
||||
}
|
||||
|
||||
m_textSize=m_text->size();
|
||||
TextPtr text = textDocument();
|
||||
m_textSize= text->size();
|
||||
if (text->begin().isValid() && text->begin().layout()->lineAt(0).isValid())
|
||||
m_firstLineSize = text->begin().layout()->lineAt(0).height();
|
||||
}
|
||||
|
||||
QString TextItem::formatDateTime(const QDateTime &value)
|
||||
@@ -454,6 +471,167 @@ QString TextItem::formatFieldValue()
|
||||
}
|
||||
}
|
||||
|
||||
TextItem::TextPtr TextItem::textDocument() const
|
||||
{
|
||||
TextPtr text(new QTextDocument);
|
||||
|
||||
if (allowHTML())
|
||||
text->setHtml(m_strText);
|
||||
else
|
||||
text->setPlainText(m_strText);
|
||||
|
||||
QTextOption to;
|
||||
to.setAlignment(m_alignment);
|
||||
to.setTextDirection(m_textLayoutDirection);
|
||||
//to.setTextDirection(QApplication::layoutDirection());
|
||||
|
||||
if (m_autoWidth!=MaxStringLength)
|
||||
if (m_adaptFontToSize && (!(m_autoHeight || m_autoWidth)))
|
||||
to.setWrapMode(QTextOption::WordWrap);
|
||||
else
|
||||
to.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
|
||||
else to.setWrapMode(QTextOption::NoWrap);
|
||||
|
||||
text->setDocumentMargin(0);
|
||||
text->setDefaultTextOption(to);
|
||||
|
||||
QFont _font = transformToSceneFont(font());
|
||||
if (m_adaptFontToSize && (!(m_autoHeight || m_autoWidth))){
|
||||
adaptFontSize(text);
|
||||
} else {
|
||||
setTextFont(text,_font);
|
||||
}
|
||||
|
||||
if (follower())
|
||||
text->documentLayout();
|
||||
|
||||
if (m_lineSpacing != 1 || m_textIndent !=0 ){
|
||||
|
||||
for ( QTextBlock block = text->begin(); block.isValid(); block = block.next())
|
||||
{
|
||||
QTextCursor tc = QTextCursor(block);
|
||||
QTextBlockFormat fmt = block.blockFormat();
|
||||
fmt.setTextIndent(m_textIndent);
|
||||
if (fmt.lineHeight() != m_lineSpacing) {
|
||||
fmt.setLineHeight(m_lineSpacing,QTextBlockFormat::LineDistanceHeight);
|
||||
}
|
||||
tc.setBlockFormat( fmt );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return text;
|
||||
|
||||
}
|
||||
|
||||
qreal TextItem::textIndent() const
|
||||
{
|
||||
return m_textIndent;
|
||||
}
|
||||
|
||||
void TextItem::setTextIndent(const qreal &textIndent)
|
||||
{
|
||||
if (m_textIndent != textIndent){
|
||||
qreal oldValue = m_textIndent;
|
||||
m_textIndent = textIndent;
|
||||
update();
|
||||
notify("textIndent", oldValue, textIndent);
|
||||
}
|
||||
}
|
||||
|
||||
Qt::LayoutDirection TextItem::textLayoutDirection() const
|
||||
{
|
||||
return m_textLayoutDirection;
|
||||
}
|
||||
|
||||
void TextItem::setTextLayoutDirection(const Qt::LayoutDirection &textLayoutDirection)
|
||||
{
|
||||
if (m_textLayoutDirection != textLayoutDirection){
|
||||
int oldValue = int(m_textLayoutDirection);
|
||||
m_textLayoutDirection = textLayoutDirection;
|
||||
update();
|
||||
notify("textLayoutDirection",oldValue,int(textLayoutDirection));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QString TextItem::followTo() const
|
||||
{
|
||||
return m_followTo;
|
||||
}
|
||||
|
||||
void TextItem::setFollowTo(const QString &followTo)
|
||||
{
|
||||
if (m_followTo != followTo){
|
||||
QString oldValue = m_followTo;
|
||||
m_followTo = followTo;
|
||||
if (!isLoading()){
|
||||
TextItem* fi = scene()->findChild<TextItem*>(oldValue);
|
||||
if (fi) fi->clearFollower();
|
||||
fi = scene()->findChild<TextItem*>(followTo);
|
||||
if (fi && fi != this){
|
||||
if (initFollower(followTo)){
|
||||
notify("followTo",oldValue,followTo);
|
||||
} else {
|
||||
m_followTo = "";
|
||||
QMessageBox::critical(
|
||||
0,
|
||||
tr("Error"),
|
||||
tr("TextItem \" %1 \" already has folower \" %2 \" ")
|
||||
.arg(fi->objectName())
|
||||
.arg(fi->follower()->objectName())
|
||||
);
|
||||
notify("followTo",followTo,"");
|
||||
}
|
||||
} else if (m_followTo != ""){
|
||||
QMessageBox::critical(
|
||||
0,
|
||||
tr("Error"),
|
||||
tr("TextItem \" %1 \" not found!")
|
||||
.arg(m_followTo)
|
||||
);
|
||||
notify("followTo",followTo,"");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TextItem::setFollower(TextItem *follower)
|
||||
{
|
||||
if (!m_follower){
|
||||
m_follower = follower;
|
||||
}
|
||||
}
|
||||
|
||||
void TextItem::clearFollower()
|
||||
{
|
||||
m_follower = 0;
|
||||
}
|
||||
|
||||
bool TextItem::hasFollower() const
|
||||
{
|
||||
return m_follower != 0;
|
||||
}
|
||||
|
||||
bool TextItem::initFollower(QString follower)
|
||||
{
|
||||
TextItem* fi = scene()->findChild<TextItem*>(follower);
|
||||
if (fi){
|
||||
if (!fi->hasFollower()){
|
||||
fi->setFollower(this);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void TextItem::pageObjectHasBeenLoaded()
|
||||
{
|
||||
if (!m_followTo.isEmpty()){
|
||||
initFollower(m_followTo);
|
||||
}
|
||||
}
|
||||
|
||||
TextItem::ValueType TextItem::valueType() const
|
||||
{
|
||||
return m_valueType;
|
||||
@@ -497,13 +675,14 @@ void TextItem::setAllowHTML(bool allowHTML)
|
||||
{
|
||||
if (m_allowHTML!=allowHTML){
|
||||
m_allowHTML = allowHTML;
|
||||
if (m_text){
|
||||
if (allowHTML)
|
||||
m_text->setHtml(m_strText);
|
||||
else
|
||||
m_text->setPlainText(m_strText);
|
||||
update();
|
||||
}
|
||||
// if (m_text){
|
||||
// if (allowHTML)
|
||||
// m_text->setHtml(m_strText);
|
||||
// else
|
||||
// m_text->setPlainText(m_strText);
|
||||
// update();
|
||||
// }
|
||||
update();
|
||||
notify("allowHTML",!m_allowHTML,allowHTML);
|
||||
}
|
||||
}
|
||||
@@ -521,22 +700,19 @@ void TextItem::setTrimValue(bool value)
|
||||
|
||||
|
||||
void TextItem::geometryChangedEvent(QRectF , QRectF)
|
||||
{
|
||||
// if ((m_angle==Angle0)||(m_angle==Angle180)){
|
||||
// m_text->setTextWidth(rect().width()-fakeMarginSize()*2);
|
||||
// } else {
|
||||
// m_text->setTextWidth(rect().height()-fakeMarginSize()*2);
|
||||
// }
|
||||
if (itemMode() == DesignMode) initText();
|
||||
else if (adaptFontToSize()) initText();
|
||||
|
||||
}
|
||||
{}
|
||||
|
||||
bool TextItem::isNeedUpdateSize(RenderPass pass) const
|
||||
{
|
||||
Q_UNUSED(pass)
|
||||
|
||||
if ((autoHeight() || autoWidth()) || hasFollower()){
|
||||
initTextSizes();
|
||||
}
|
||||
|
||||
bool res = (m_textSize.height()>geometry().height()&&autoHeight()) ||
|
||||
(m_textSize.width()>geometry().width()&&autoWidth()) ||
|
||||
m_follower ||
|
||||
isNeedExpandContent();
|
||||
return res;
|
||||
}
|
||||
@@ -548,7 +724,6 @@ void TextItem::setAlignment(Qt::Alignment value)
|
||||
m_alignment=value;
|
||||
//m_layout.setTextOption(QTextOption(m_alignment));
|
||||
if (!isLoading()){
|
||||
initText();
|
||||
update(rect());
|
||||
notify("alignment",QVariant(oldValue),QVariant(value));
|
||||
}
|
||||
@@ -575,6 +750,7 @@ void TextItem::expandContent(DataSourceManager* dataManager, RenderPass pass)
|
||||
} else {
|
||||
setContent(context);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void TextItem::setAutoHeight(bool value)
|
||||
@@ -600,7 +776,7 @@ void TextItem::setAdaptFontToSize(bool value)
|
||||
if (m_adaptFontToSize!=value){
|
||||
bool oldValue = m_adaptFontToSize;
|
||||
m_adaptFontToSize=value;
|
||||
initText();
|
||||
// initText();
|
||||
invalidateRect(rect());
|
||||
notify("updateFontToSize",oldValue,value);
|
||||
}
|
||||
@@ -608,66 +784,84 @@ void TextItem::setAdaptFontToSize(bool value)
|
||||
|
||||
bool TextItem::canBeSplitted(int height) const
|
||||
{
|
||||
return height>(m_text->begin().layout()->lineAt(0).height());
|
||||
QFontMetrics fm(font());
|
||||
return height > m_firstLineSize;
|
||||
}
|
||||
|
||||
QString TextItem::getTextPart(int height, int skipHeight){
|
||||
int linesHeight = 0;
|
||||
int curLine = 0;
|
||||
int textPos = 0;
|
||||
|
||||
TextPtr text = textDocument();
|
||||
|
||||
QTextBlock curBlock = text->begin();
|
||||
QString resultText = "";
|
||||
|
||||
if (skipHeight > 0){
|
||||
for (;curBlock != text->end(); curBlock=curBlock.next()){
|
||||
for (curLine = 0; curLine < curBlock.layout()->lineCount(); curLine++){
|
||||
linesHeight += curBlock.layout()->lineAt(curLine).height() + lineSpacing();
|
||||
if (linesHeight > (skipHeight-(/*fakeMarginSize()*2+*/borderLineSize() * 2))) {goto loop_exit;}
|
||||
}
|
||||
}
|
||||
loop_exit:;
|
||||
}
|
||||
|
||||
linesHeight = 0;
|
||||
|
||||
for (;curBlock != text->end() || curLine<curBlock.lineCount(); curBlock = curBlock.next(), curLine = 0, resultText += '\n'){
|
||||
for (; curLine<curBlock.layout()->lineCount(); curLine++){
|
||||
if (resultText == "") textPos= curBlock.layout()->lineAt(curLine).textStart();
|
||||
linesHeight += curBlock.layout()->lineAt(curLine).height() + lineSpacing();
|
||||
if ( (height>0) && (linesHeight>(height-(/*fakeMarginSize()*2+*/borderLineSize()*2))) ) {
|
||||
linesHeight-=curBlock.layout()->lineAt(curLine).height();
|
||||
goto loop_exit1;
|
||||
}
|
||||
resultText+=curBlock.text().mid(curBlock.layout()->lineAt(curLine).textStart(),
|
||||
curBlock.layout()->lineAt(curLine).textLength());
|
||||
}
|
||||
}
|
||||
loop_exit1:;
|
||||
|
||||
resultText.chop(1);
|
||||
|
||||
QScopedPointer<HtmlContext> context(new HtmlContext(m_strText));
|
||||
return context->extendTextByTags(resultText,textPos);
|
||||
}
|
||||
|
||||
void TextItem::restoreLinksEvent()
|
||||
{
|
||||
if (!followTo().isEmpty()){
|
||||
BaseDesignIntf* pi = dynamic_cast<BaseDesignIntf*>(parentItem());
|
||||
if (pi){
|
||||
foreach (BaseDesignIntf* bi, pi->childBaseItems()) {
|
||||
if (bi->patternName().compare(followTo())==0){
|
||||
TextItem* ti = dynamic_cast<TextItem*>(bi);
|
||||
if (ti){
|
||||
ti->setFollower(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BaseDesignIntf *TextItem::cloneUpperPart(int height, QObject *owner, QGraphicsItem *parent)
|
||||
{
|
||||
int linesHeight=0;
|
||||
QString tmpText="";
|
||||
TextItem* upperPart = dynamic_cast<TextItem*>(cloneItem(itemMode(),owner,parent));
|
||||
|
||||
for (QTextBlock it=m_text->begin();it!=m_text->end();it=it.next()){
|
||||
for (int i=0;i<it.layout()->lineCount();i++){
|
||||
linesHeight+=it.layout()->lineAt(i).height()+lineSpacing();
|
||||
if (linesHeight>(height-(fakeMarginSize()*2+borderLineSize()*2))) {
|
||||
linesHeight-=it.layout()->lineAt(i).height();
|
||||
goto loop_exit;
|
||||
}
|
||||
tmpText+=it.text().mid(it.layout()->lineAt(i).textStart(),it.layout()->lineAt(i).textLength())+'\n';
|
||||
}
|
||||
}
|
||||
loop_exit:
|
||||
tmpText.chop(1);
|
||||
|
||||
upperPart->setHeight(linesHeight+fakeMarginSize()*2+borderLineSize()*2);
|
||||
QScopedPointer<HtmlContext> context(new HtmlContext(m_strText));
|
||||
upperPart->setContent(context->extendTextByTags(tmpText,0));
|
||||
upperPart->initText();
|
||||
upperPart->setContent(getTextPart(height,0));
|
||||
upperPart->initTextSizes();
|
||||
upperPart->setHeight(upperPart->textSize().height()+borderLineSize()*2);
|
||||
return upperPart;
|
||||
}
|
||||
|
||||
BaseDesignIntf *TextItem::cloneBottomPart(int height, QObject *owner, QGraphicsItem *parent)
|
||||
{
|
||||
TextItem* bottomPart = dynamic_cast<TextItem*>(cloneItem(itemMode(),owner,parent));
|
||||
int linesHeight=0;
|
||||
int curLine=0;
|
||||
QTextBlock curBlock;
|
||||
|
||||
QString tmpText="";
|
||||
|
||||
for (curBlock=m_text->begin();curBlock!=m_text->end();curBlock=curBlock.next()){
|
||||
for (curLine=0;curLine<curBlock.layout()->lineCount();curLine++){
|
||||
linesHeight+=curBlock.layout()->lineAt(curLine).height()+lineSpacing();
|
||||
if (linesHeight>(height-(fakeMarginSize()*2+borderLineSize()*2))) {goto loop_exit;}
|
||||
}
|
||||
}
|
||||
loop_exit:;
|
||||
|
||||
int textPos=0;
|
||||
for (;curBlock!=m_text->end() || curLine<curBlock.lineCount();curBlock=curBlock.next(), curLine=0, tmpText+='\n'){
|
||||
for (;curLine<curBlock.layout()->lineCount();curLine++){
|
||||
if (tmpText=="") textPos= curBlock.layout()->lineAt(curLine).textStart();
|
||||
tmpText+=curBlock.text().mid(curBlock.layout()->lineAt(curLine).textStart(),
|
||||
curBlock.layout()->lineAt(curLine).textLength());
|
||||
}
|
||||
}
|
||||
tmpText.chop(1);
|
||||
|
||||
QScopedPointer<HtmlContext> context(new HtmlContext(m_strText));
|
||||
bottomPart->setContent(context->extendTextByTags(tmpText,textPos));
|
||||
bottomPart->initText();
|
||||
bottomPart->setHeight(bottomPart->m_textSize.height()+borderLineSize()*2);
|
||||
bottomPart->setContent(getTextPart(0,height));
|
||||
bottomPart->initTextSizes();
|
||||
bottomPart->setHeight(bottomPart->textSize().height()+borderLineSize()*2);
|
||||
return bottomPart;
|
||||
}
|
||||
|
||||
@@ -687,9 +881,10 @@ BaseDesignIntf *TextItem::cloneEmpty(int height, QObject *owner, QGraphicsItem *
|
||||
void TextItem::objectLoadFinished()
|
||||
{
|
||||
ItemDesignIntf::objectLoadFinished();
|
||||
if (itemMode() == DesignMode || !isNeedExpandContent()){
|
||||
initText();
|
||||
}
|
||||
// if (itemMode() == DesignMode || !isNeedExpandContent()){
|
||||
// if (autoHeight() && autoWidth())
|
||||
// initTextSizes();
|
||||
// }
|
||||
}
|
||||
|
||||
void TextItem::setTextItemFont(QFont value)
|
||||
@@ -697,7 +892,7 @@ void TextItem::setTextItemFont(QFont value)
|
||||
if (font()!=value){
|
||||
QFont oldValue = font();
|
||||
setFont(value);
|
||||
m_text->setDefaultFont(transformToSceneFont(value));
|
||||
update();
|
||||
notify("font",oldValue,value);
|
||||
}
|
||||
}
|
||||
@@ -759,7 +954,6 @@ void TextItem::setAngle(const AngleType& value)
|
||||
AngleType oldValue = m_angle;
|
||||
m_angle = value;
|
||||
if (!isLoading()){
|
||||
initText();
|
||||
update();
|
||||
notify("angle",oldValue,value);
|
||||
}
|
||||
|
@@ -32,15 +32,16 @@
|
||||
#include <QGraphicsTextItem>
|
||||
#include <QtGui>
|
||||
#include <QLabel>
|
||||
#include "lritemdesignintf.h"
|
||||
#include <qnamespace.h>
|
||||
|
||||
#include <QTextDocument>
|
||||
|
||||
#include "lritemdesignintf.h"
|
||||
#include "lritemdesignintf.h"
|
||||
#include "lrpageinitintf.h"
|
||||
|
||||
namespace LimeReport {
|
||||
|
||||
class Tag;
|
||||
class TextItem : public LimeReport::ContentItemDesignIntf {
|
||||
class TextItem : public LimeReport::ContentItemDesignIntf, IPageInit {
|
||||
Q_OBJECT
|
||||
Q_ENUMS(AutoWidth)
|
||||
Q_ENUMS(AngleType)
|
||||
@@ -66,6 +67,10 @@ class TextItem : public LimeReport::ContentItemDesignIntf {
|
||||
Q_PROPERTY(bool allowHTMLInFields READ allowHTMLInFields WRITE setAllowHTMLInFields)
|
||||
Q_PROPERTY(QString format READ format WRITE setFormat)
|
||||
Q_PROPERTY(ValueType valueType READ valueType WRITE setValueType)
|
||||
Q_PROPERTY(QString followTo READ followTo WRITE setFollowTo)
|
||||
Q_PROPERTY(BrushStyle backgroundBrushStyle READ backgroundBrushStyle WRITE setBackgroundBrushStyle)
|
||||
Q_PROPERTY(qreal textIndent READ textIndent WRITE setTextIndent)
|
||||
Q_PROPERTY(Qt::LayoutDirection textLayoutDirection READ textLayoutDirection WRITE setTextLayoutDirection)
|
||||
public:
|
||||
|
||||
enum AutoWidth{NoneAutoWidth,MaxWordLength,MaxStringLength};
|
||||
@@ -99,7 +104,7 @@ public:
|
||||
|
||||
bool canBeSplitted(int height) const;
|
||||
bool isSplittable() const { return true;}
|
||||
bool isEmpty() const{return m_text->isEmpty();}
|
||||
bool isEmpty() const{return m_strText.trimmed().isEmpty() /*m_text->isEmpty()*/;}
|
||||
BaseDesignIntf* cloneUpperPart(int height, QObject *owner, QGraphicsItem *parent);
|
||||
BaseDesignIntf* cloneBottomPart(int height, QObject *owner, QGraphicsItem *parent);
|
||||
BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0);
|
||||
@@ -140,28 +145,53 @@ public:
|
||||
ValueType valueType() const;
|
||||
void setValueType(const ValueType valueType);
|
||||
|
||||
QSizeF textSize(){ return m_textSize;}
|
||||
QString followTo() const;
|
||||
void setFollowTo(const QString &followTo);
|
||||
void setFollower(TextItem* follower);
|
||||
void clearFollower();
|
||||
bool hasFollower() const;
|
||||
TextItem* follower() const { return m_follower;}
|
||||
bool initFollower(QString follower);
|
||||
|
||||
// IPageInit interface
|
||||
void pageObjectHasBeenLoaded();
|
||||
|
||||
typedef QSharedPointer<QTextDocument> TextPtr;
|
||||
|
||||
qreal textIndent() const;
|
||||
void setTextIndent(const qreal &textIndent);
|
||||
Qt::LayoutDirection textLayoutDirection() const;
|
||||
void setTextLayoutDirection(const Qt::LayoutDirection &textLayoutDirection);
|
||||
|
||||
protected:
|
||||
void updateLayout();
|
||||
bool isNeedExpandContent() const;
|
||||
QString replaceBR(QString text);
|
||||
QString replaceReturns(QString text);
|
||||
int fakeMarginSize();
|
||||
int fakeMarginSize() const;
|
||||
QString getTextPart(int height, int skipHeight);
|
||||
void restoreLinksEvent();
|
||||
void preparePopUpMenu(QMenu &menu);
|
||||
void processPopUpAction(QAction *action);
|
||||
private:
|
||||
void initText();
|
||||
void setTextFont(const QFont &value);
|
||||
void adaptFontSize();
|
||||
void initTextSizes() const;
|
||||
void setTextFont(TextPtr text, const QFont &value) const;
|
||||
void adaptFontSize(TextPtr text) const;
|
||||
QString formatDateTime(const QDateTime &value);
|
||||
QString formatNumber(const double value);
|
||||
QString formatFieldValue();
|
||||
|
||||
TextPtr textDocument() const;
|
||||
private:
|
||||
QString m_strText;
|
||||
|
||||
//QTextLayout m_layout;
|
||||
QTextDocument* m_text;
|
||||
//QTextDocument* m_text;
|
||||
Qt::Alignment m_alignment;
|
||||
bool m_autoHeight;
|
||||
AutoWidth m_autoWidth;
|
||||
QSizeF m_textSize;
|
||||
QSizeF mutable m_textSize;
|
||||
qreal mutable m_firstLineSize;
|
||||
AngleType m_angle;
|
||||
int m_foregroundOpacity;
|
||||
bool m_underlines;
|
||||
@@ -174,6 +204,10 @@ private:
|
||||
|
||||
QString m_format;
|
||||
ValueType m_valueType;
|
||||
QString m_followTo;
|
||||
TextItem* m_follower;
|
||||
qreal m_textIndent;
|
||||
Qt::LayoutDirection m_textLayoutDirection;
|
||||
};
|
||||
|
||||
}
|
||||
|
@@ -124,8 +124,8 @@ void TextItemEditor::initUI()
|
||||
ui->twData->setModel(dm->datasourcesModel());
|
||||
ui->twScriptEngine->setModel(se.model());
|
||||
|
||||
foreach(QString dsName,dm->dataSourceNames()){
|
||||
foreach(QString field, dm->fieldNames(dsName)){
|
||||
foreach(const QString &dsName,dm->dataSourceNames()){
|
||||
foreach(const QString &field, dm->fieldNames(dsName)){
|
||||
dataWords<<dsName+"."+field;
|
||||
}
|
||||
}
|
||||
@@ -133,7 +133,7 @@ void TextItemEditor::initUI()
|
||||
ui->tabWidget->setVisible(false);
|
||||
}
|
||||
|
||||
foreach (LimeReport::ScriptFunctionDesc functionDesc, se.functionsDescriber()) {
|
||||
foreach (LimeReport::ScriptFunctionDesc functionDesc, se.functionsDescribers()) {
|
||||
dataWords<<functionDesc.name;
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,9 @@
|
||||
include(../common.pri)
|
||||
|
||||
contains(CONFIG,dialogdesigner){
|
||||
include($$REPORT_PATH/dialogdesigner/dialogdesigner.pri)
|
||||
}
|
||||
|
||||
DEFINES += INSPECT_BASEDESIGN
|
||||
|
||||
INCLUDEPATH += \
|
||||
@@ -19,6 +23,15 @@ SOURCES += \
|
||||
$$REPORT_PATH/bands/lrgroupbands.cpp \
|
||||
$$REPORT_PATH/bands/lrsubdetailband.cpp \
|
||||
$$REPORT_PATH/bands/lrtearoffband.cpp \
|
||||
$$REPORT_PATH/databrowser/lrdatabrowser.cpp \
|
||||
$$REPORT_PATH/databrowser/lrsqleditdialog.cpp \
|
||||
$$REPORT_PATH/databrowser/lrconnectiondialog.cpp \
|
||||
$$REPORT_PATH/databrowser/lrvariabledialog.cpp \
|
||||
$$REPORT_PATH/databrowser/lrdatabrowsertree.cpp \
|
||||
$$REPORT_PATH/serializators/lrxmlqrectserializator.cpp \
|
||||
$$REPORT_PATH/serializators/lrxmlbasetypesserializators.cpp \
|
||||
$$REPORT_PATH/serializators/lrxmlreader.cpp \
|
||||
$$REPORT_PATH/serializators/lrxmlwriter.cpp \
|
||||
$$REPORT_PATH/objectinspector/propertyItems/lrstringpropitem.cpp \
|
||||
$$REPORT_PATH/objectinspector/propertyItems/lrrectproptem.cpp \
|
||||
$$REPORT_PATH/objectinspector/propertyItems/lrintpropitem.cpp \
|
||||
@@ -44,16 +57,8 @@ SOURCES += \
|
||||
$$REPORT_PATH/objectinspector/lrobjectitemmodel.cpp \
|
||||
$$REPORT_PATH/objectinspector/lrobjectpropitem.cpp \
|
||||
$$REPORT_PATH/objectinspector/lrpropertydelegate.cpp \
|
||||
$$REPORT_PATH/objectsbrowser/lrobjectbrowser.cpp \
|
||||
$$REPORT_PATH/databrowser/lrdatabrowser.cpp \
|
||||
$$REPORT_PATH/databrowser/lrsqleditdialog.cpp \
|
||||
$$REPORT_PATH/databrowser/lrconnectiondialog.cpp \
|
||||
$$REPORT_PATH/databrowser/lrvariabledialog.cpp \
|
||||
$$REPORT_PATH/databrowser/lrdatabrowsertree.cpp \
|
||||
$$REPORT_PATH/serializators/lrxmlqrectserializator.cpp \
|
||||
$$REPORT_PATH/serializators/lrxmlbasetypesserializators.cpp \
|
||||
$$REPORT_PATH/serializators/lrxmlreader.cpp \
|
||||
$$REPORT_PATH/serializators/lrxmlwriter.cpp \
|
||||
$$REPORT_PATH/objectsbrowser/lrobjectbrowser.cpp \
|
||||
$$REPORT_PATH/scriptbrowser/lrscriptbrowser.cpp \
|
||||
$$REPORT_PATH/items/lrsubitemparentpropitem.cpp \
|
||||
$$REPORT_PATH/items/lralignpropitem.cpp \
|
||||
$$REPORT_PATH/items/lrhorizontallayout.cpp \
|
||||
@@ -89,11 +94,15 @@ SOURCES += \
|
||||
$$REPORT_PATH/lrsimplecrypt.cpp \
|
||||
$$REPORT_PATH/lraboutdialog.cpp \
|
||||
$$REPORT_PATH/lrsettingdialog.cpp \
|
||||
$$REPORT_PATH/scriptbrowser/lrscriptbrowser.cpp \
|
||||
$$REPORT_PATH/lrcolorindicator.cpp \
|
||||
$$REPORT_PATH/lritemscontainerdesignitf.cpp \
|
||||
$$REPORT_PATH/lrcolorindicator.cpp \
|
||||
$$REPORT_PATH/items/lrchartitem.cpp \
|
||||
$$REPORT_PATH/items/lrchartitemeditor.cpp
|
||||
|
||||
contains(CONFIG, staticlib){
|
||||
SOURCES += $$REPORT_PATH/lrfactoryinitializer.cpp
|
||||
}
|
||||
|
||||
contains(CONFIG, zint){
|
||||
SOURCES += $$REPORT_PATH/items/lrbarcodeitem.cpp
|
||||
}
|
||||
@@ -148,6 +157,7 @@ HEADERS += \
|
||||
$$REPORT_PATH/objectinspector/lrobjectpropitem.h \
|
||||
$$REPORT_PATH/objectinspector/lrpropertydelegate.h \
|
||||
$$REPORT_PATH/objectsbrowser/lrobjectbrowser.h \
|
||||
$$REPORT_PATH/scriptbrowser/lrscriptbrowser.h \
|
||||
$$REPORT_PATH/items/editors/lritemeditorwidget.h \
|
||||
$$REPORT_PATH/items/editors/lrfonteditorwidget.h \
|
||||
$$REPORT_PATH/items/editors/lrtextalignmenteditorwidget.h \
|
||||
@@ -161,6 +171,7 @@ HEADERS += \
|
||||
$$REPORT_PATH/items/lrshapeitem.h \
|
||||
$$REPORT_PATH/items/lrimageitem.h \
|
||||
$$REPORT_PATH/items/lrsimpletagparser.h \
|
||||
$$REPORT_PATH/lrfactoryinitializer.h \
|
||||
$$REPORT_PATH/lrbanddesignintf.h \
|
||||
$$REPORT_PATH/lrpageitemdesignintf.h \
|
||||
$$REPORT_PATH/lrbandsmanager.h \
|
||||
@@ -191,10 +202,14 @@ HEADERS += \
|
||||
$$REPORT_PATH/lrcallbackdatasourceintf.h \
|
||||
$$REPORT_PATH/lrsettingdialog.h \
|
||||
$$REPORT_PATH/lrpreviewreportwidget_p.h \
|
||||
$$REPORT_PATH/scriptbrowser/lrscriptbrowser.h \
|
||||
$$REPORT_PATH/lrcolorindicator.h \
|
||||
$$REPORT_PATH/lritemscontainerdesignitf.h \
|
||||
$$REPORT_PATH/lrcolorindicator.h \
|
||||
$$REPORT_PATH/items/lrchartitem.h \
|
||||
$$REPORT_PATH/items/lrchartitemeditor.h
|
||||
|
||||
contains(CONFIG, staticlib){
|
||||
HEADERS += $$REPORT_PATH/lrfactoryinitializer.h
|
||||
}
|
||||
|
||||
contains(CONFIG,zint){
|
||||
HEADERS += $$REPORT_PATH/items/lrbarcodeitem.h
|
||||
@@ -214,7 +229,6 @@ FORMS += \
|
||||
$$REPORT_PATH/scriptbrowser/lrscriptbrowser.ui \
|
||||
$$REPORT_PATH/items/lrchartitemeditor.ui
|
||||
|
||||
|
||||
RESOURCES += \
|
||||
$$REPORT_PATH/objectinspector/lobjectinspector.qrc \
|
||||
$$REPORT_PATH/databrowser/lrdatabrowser.qrc \
|
||||
|
@@ -1,8 +1,15 @@
|
||||
TARGET = limereport
|
||||
TEMPLATE = lib
|
||||
|
||||
CONFIG += lib
|
||||
CONFIG += dll
|
||||
contains(CONFIG, static_build){
|
||||
CONFIG += staticlib
|
||||
}
|
||||
|
||||
!contains(CONFIG, staticlib){
|
||||
CONFIG += lib
|
||||
CONFIG += dll
|
||||
}
|
||||
|
||||
CONFIG += create_prl
|
||||
CONFIG += link_prl
|
||||
|
||||
@@ -14,6 +21,12 @@ macx{
|
||||
|
||||
DEFINES += LIMEREPORT_EXPORTS
|
||||
|
||||
contains(CONFIG, staticlib){
|
||||
DEFINES += HAVE_STATIC_BUILD
|
||||
message(STATIC_BUILD)
|
||||
DEFINES -= LIMEREPORT_EXPORTS
|
||||
}
|
||||
|
||||
EXTRA_FILES += \
|
||||
$$PWD/lrglobal.cpp \
|
||||
$$PWD/lrglobal.h \
|
||||
@@ -67,23 +80,23 @@ contains(CONFIG,zint){
|
||||
####Automatically build required translation files (*.qm)
|
||||
|
||||
contains(CONFIG,build_translations){
|
||||
LANGUAGES = ru es_ES
|
||||
LANGUAGES = ru es_ES ar
|
||||
|
||||
defineReplace(prependAll) {
|
||||
for(a,$$1):result += $$2$${a}$$3
|
||||
return($$result)
|
||||
}
|
||||
|
||||
TRANSLATIONS = $$prependAll(LANGUAGES, $$TRANSLATIONS_PATH/limereport_,.ts)
|
||||
TRANSLATIONS = $$prependAll(LANGUAGES, \"$$TRANSLATIONS_PATH/limereport_,.ts\")
|
||||
|
||||
qtPrepareTool(LUPDATE, lupdate)
|
||||
ts.commands = $$LUPDATE $$PWD -ts $$TRANSLATIONS
|
||||
ts.commands = $$LUPDATE $$shell_quote($$PWD) -ts $$TRANSLATIONS
|
||||
|
||||
TRANSLATIONS_FILES =
|
||||
qtPrepareTool(LRELEASE, lrelease)
|
||||
for(tsfile, TRANSLATIONS) {
|
||||
qmfile = $$tsfile
|
||||
qmfile ~= s,.ts$,.qm,
|
||||
qmfile ~= s,".ts\"$",".qm\"",
|
||||
qm.commands += $$LRELEASE -removeidentical $$tsfile -qm $$qmfile $$escape_expand(\\n\\t)
|
||||
tmp_command = $$LRELEASE -removeidentical $$tsfile -qm $$qmfile $$escape_expand(\\n\\t)
|
||||
TRANSLATIONS_FILES += $$qmfile
|
||||
|
@@ -34,15 +34,15 @@
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><img src=":/report/images/logo_100.png" height="100" style="float: left;" /><span style=" font-size:12pt; font-weight:600; color:#555555;">Report engine for </span><span style=" font-size:12pt; font-weight:600; color:#7faa18;">Qt</span><span style=" font-size:12pt; font-weight:600; color:#555555;"> framework</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><img src=":/report/images/logo_100.png" height="100" style="float: left;" /><span style=" font-size:12pt; font-weight:600;">Report engine for </span><span style=" font-size:12pt; font-weight:600; color:#7faa18;">Qt</span><span style=" font-size:12pt; font-weight:600;"> framework</span></p>
|
||||
<p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:11pt;">LimeReport - multi-platform C++ library written using Qt framework and intended for software developers that would like to add into their application capability to form report or print forms generated using templates.</span></p>
|
||||
<p align="justify" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt;"><br /></p>
|
||||
<p align="justify" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt;"><br /></p>
|
||||
<p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:11pt;">Official web site : </span><a href="www.limereport.ru"><span style=" font-size:11pt; text-decoration: underline; color:#0000ff;">www.limereport.ru</span></a></p>
|
||||
<p align="justify" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt; text-decoration: underline; color:#0000ff;"><br /></p>
|
||||
<p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt; font-weight:600; color:#000000;">This library 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.</span></p>
|
||||
<p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt; font-weight:600;">This library 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.</span></p>
|
||||
<p align="justify" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt; font-weight:600; color:#000000;"><br /></p>
|
||||
<p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt; color:#000000;">Copyright 2015 Arin Alexander. All rights reserved.</span></p></body></html></string>
|
||||
<p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">Copyright 2015 Arin Alexander. All rights reserved.</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -87,114 +87,114 @@ p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">(c) 2015 Arin Alexander arin_a@bk.ru</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="SEC1"></a><span style=" font-family:'sans-serif'; font-weight:600; color:#333333;">G</span><span style=" font-family:'sans-serif'; font-weight:600; color:#333333;">NU LESSER GENERAL PUBLIC LICENSE</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">Version 2.1, February 1999</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;">Copyright (C) 1991, 1999 Free Software Foundation, Inc.</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;">51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;">Everyone is permitted to copy and distribute verbatim copies</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;">of this license document, but changing it is not allowed.</span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'monospace'; color:#000000; background-color:#ffffff;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;">[This is the first released version of the Lesser GPL. It also counts</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;"> as the successor of the GNU Library Public License, version 2, hence</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;"> the version number 2.1.]</span></p>
|
||||
<p style=" margin-top:15px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><a name="SEC2"></a><span style=" font-family:'sans-serif'; font-weight:600; color:#333333;">P</span><span style=" font-family:'sans-serif'; font-weight:600; color:#333333;">reamble</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">We call this license the &quot;Lesser&quot; General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a &quot;work based on the library&quot; and a &quot;work that uses the library&quot;. The former contains code derived from the library, whereas the latter must be combined with the library in order to run.</span></p>
|
||||
<p style=" margin-top:15px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><a name="SEC3"></a><span style=" font-family:'sans-serif'; font-weight:600; color:#333333;">T</span><span style=" font-family:'sans-serif'; font-weight:600; color:#333333;">ERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">0.</span><span style=" font-family:'sans-serif'; color:#000000;"> This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called &quot;this License&quot;). Each licensee is addressed as &quot;you&quot;.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">A &quot;library&quot; means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">The &quot;Library&quot;, below, refers to any such software library or work which has been distributed under these terms. A &quot;work based on the Library&quot; means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term &quot;modification&quot;.)</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">&quot;Source code&quot; for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">1.</span><span style=" font-family:'sans-serif'; color:#000000;"> You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">2.</span><span style=" font-family:'sans-serif'; color:#000000;"> You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:</span></p>
|
||||
<ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" font-family:'sans-serif'; color:#000000;" style=" margin-top:19px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">a)</span><span style=" font-size:16px;"> The modified work must itself be a software library.</span></li>
|
||||
<li style=" font-family:'sans-serif'; color:#000000;" style=" margin-top:0px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">b)</span><span style=" font-size:16px;"> You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change.</span></li>
|
||||
<li style=" font-family:'sans-serif'; color:#000000;" style=" margin-top:0px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">c)</span><span style=" font-size:16px;"> You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License.</span></li>
|
||||
<li style=" font-family:'sans-serif'; color:#000000;" style=" margin-top:0px; margin-bottom:19px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">d)</span><span style=" font-size:16px;"> If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful.</span></li></ul>
|
||||
<p style=" margin-top:15px; margin-bottom:15px; margin-left:38px; margin-right:19px; -qt-block-indent:1; text-indent:0px;"><span style=" font-family:'sans-serif'; color:#000000;">(For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.)</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">3.</span><span style=" font-family:'sans-serif'; color:#000000;"> You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">This option is useful when you wish to copy part of the code of the Library into a program that is not a library.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">4.</span><span style=" font-family:'sans-serif'; color:#000000;"> You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">5.</span><span style=" font-family:'sans-serif'; color:#000000;"> A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a &quot;work that uses the Library&quot;. Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">However, linking a &quot;work that uses the Library&quot; with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a &quot;work that uses the library&quot;. The executable is therefore covered by this License. Section 6 states terms for distribution of such executables.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">When a &quot;work that uses the Library&quot; uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.)</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">6.</span><span style=" font-family:'sans-serif'; color:#000000;"> As an exception to the Sections above, you may also combine or link a &quot;work that uses the Library&quot; with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things:</span></p>
|
||||
<ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" font-family:'sans-serif'; color:#000000;" style=" margin-top:19px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">a)</span><span style=" font-size:16px;"> Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable &quot;work that uses the Library&quot;, as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.)</span></li>
|
||||
<li style=" font-family:'sans-serif'; color:#000000;" style=" margin-top:0px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">b)</span><span style=" font-size:16px;"> Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with.</span></li>
|
||||
<li style=" font-family:'sans-serif'; color:#000000;" style=" margin-top:0px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">c)</span><span style=" font-size:16px;"> Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution.</span></li>
|
||||
<li style=" font-family:'sans-serif'; color:#000000;" style=" margin-top:0px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">d)</span><span style=" font-size:16px;"> If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place.</span></li>
|
||||
<li style=" font-family:'sans-serif'; color:#000000;" style=" margin-top:0px; margin-bottom:19px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">e)</span><span style=" font-size:16px;"> Verify that the user has already received a copy of these materials or that you have already sent this user a copy.</span></li></ul>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">For an executable, the required form of the &quot;work that uses the Library&quot; must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">7.</span><span style=" font-family:'sans-serif'; color:#000000;"> You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things:</span></p>
|
||||
<ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" font-family:'sans-serif'; color:#000000;" style=" margin-top:19px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">a)</span><span style=" font-size:16px;"> Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above.</span></li>
|
||||
<li style=" font-family:'sans-serif'; color:#000000;" style=" margin-top:0px; margin-bottom:19px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">b)</span><span style=" font-size:16px;"> Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.</span></li></ul>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">8.</span><span style=" font-family:'sans-serif'; color:#000000;"> You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">9.</span><span style=" font-family:'sans-serif'; color:#000000;"> You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">10.</span><span style=" font-family:'sans-serif'; color:#000000;"> Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">11.</span><span style=" font-family:'sans-serif'; color:#000000;"> If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">12.</span><span style=" font-family:'sans-serif'; color:#000000;"> If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">13.</span><span style=" font-family:'sans-serif'; color:#000000;"> The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and &quot;any later version&quot;, you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">14.</span><span style=" font-family:'sans-serif'; color:#000000;"> If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">NO WARRANTY</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">15.</span><span style=" font-family:'sans-serif'; color:#000000;"> BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY &quot;AS IS&quot; WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">16.</span><span style=" font-family:'sans-serif'; color:#000000;"> IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.</span></p>
|
||||
<p style=" margin-top:15px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#333333; background-color:#ffffff;">END OF TERMS AND CONDITIONS</span></p>
|
||||
<p style=" margin-top:15px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><a name="SEC4"></a><span style=" font-family:'sans-serif'; font-weight:600; color:#333333;">H</span><span style=" font-family:'sans-serif'; font-weight:600; color:#333333;">ow to Apply These Terms to Your New Libraries</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License).</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the &quot;copyright&quot; line and a pointer to where the full notice is found.</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; font-style:italic; color:#000000;">one line to give the library's name and an idea of what it does.</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">Copyright (C) </span><span style=" font-family:'monospace'; font-style:italic; color:#000000;">year</span><span style=" font-family:'monospace'; color:#000000;"> </span><span style=" font-family:'monospace'; font-style:italic; color:#000000;">name of author</span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'monospace'; font-style:italic; color:#000000; background-color:#ffffff;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">This library is free software; you can redistribute it and/or</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">modify it under the terms of the GNU Lesser General Public</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">License as published by the Free Software Foundation; either</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">version 2.1 of the License, or (at your option) any later version.</span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'monospace'; color:#000000; background-color:#ffffff;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">This library is distributed in the hope that it will be useful,</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">but WITHOUT ANY WARRANTY; without even the implied warranty of</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">Lesser General Public License for more details.</span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'monospace'; color:#000000; background-color:#ffffff;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">You should have received a copy of the GNU Lesser General Public</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">License along with this library; if not, write to the Free Software</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">Also add information on how to contact you by electronic and paper mail.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">You should also get your employer (if you work as a programmer) or your school, if any, to sign a &quot;copyright disclaimer&quot; for the library, if necessary. Here is a sample; alter the names:</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;">Yoyodyne, Inc., hereby disclaims all copyright interest in</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;">the library `Frob' (a library for tweaking knobs) written</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;">by James Random Hacker.</span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'monospace'; color:#000000; background-color:#ffffff;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; font-style:italic; color:#000000;">signature of Ty Coon</span><span style=" font-family:'monospace'; color:#000000;">, 1 April 1990</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">Ty Coon, President of Vice</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">That's all there is to it!</span></p></body></html></string>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="SEC1"></a><span style=" font-family:'sans-serif'; font-weight:600;">G</span><span style=" font-family:'sans-serif'; font-weight:600;">NU LESSER GENERAL PUBLIC LICENSE</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">Version 2.1, February 1999</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">Copyright (C) 1991, 1999 Free Software Foundation, Inc.</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">Everyone is permitted to copy and distribute verbatim copies</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">of this license document, but changing it is not allowed.</span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'monospace';"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">[This is the first released version of the Lesser GPL. It also counts</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';"> as the successor of the GNU Library Public License, version 2, hence</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';"> the version number 2.1.]</span></p>
|
||||
<p style=" margin-top:15px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="SEC2"></a><span style=" font-family:'sans-serif'; font-weight:600;">P</span><span style=" font-family:'sans-serif'; font-weight:600;">reamble</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">We call this license the &quot;Lesser&quot; General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a &quot;work based on the library&quot; and a &quot;work that uses the library&quot;. The former contains code derived from the library, whereas the latter must be combined with the library in order to run.</span></p>
|
||||
<p style=" margin-top:15px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="SEC3"></a><span style=" font-family:'sans-serif'; font-weight:600; color:#333333;">T</span><span style=" font-family:'sans-serif'; font-weight:600; color:#333333;">ERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600;">0.</span><span style=" font-family:'sans-serif';"> This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called &quot;this License&quot;). Each licensee is addressed as &quot;you&quot;.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">A &quot;library&quot; means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">The &quot;Library&quot;, below, refers to any such software library or work which has been distributed under these terms. A &quot;work based on the Library&quot; means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term &quot;modification&quot;.)</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">&quot;Source code&quot; for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600;">1.</span><span style=" font-family:'sans-serif';"> You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600;">2.</span><span style=" font-family:'sans-serif';"> You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:</span></p>
|
||||
<ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" font-family:'sans-serif';" style=" margin-top:19px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">a)</span><span style=" font-size:16px;"> The modified work must itself be a software library.</span></li>
|
||||
<li style=" font-family:'sans-serif';" style=" margin-top:0px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">b)</span><span style=" font-size:16px;"> You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change.</span></li>
|
||||
<li style=" font-family:'sans-serif';" style=" margin-top:0px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">c)</span><span style=" font-size:16px;"> You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License.</span></li>
|
||||
<li style=" font-family:'sans-serif';" style=" margin-top:0px; margin-bottom:19px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">d)</span><span style=" font-size:16px;"> If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful.</span></li></ul>
|
||||
<p style=" margin-top:15px; margin-bottom:15px; margin-left:38px; margin-right:19px; -qt-block-indent:1; text-indent:0px;"><span style=" font-family:'sans-serif';">(For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.)</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600;">3.</span><span style=" font-family:'sans-serif';"> You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">This option is useful when you wish to copy part of the code of the Library into a program that is not a library.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600;">4.</span><span style=" font-family:'sans-serif';"> You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600;">5.</span><span style=" font-family:'sans-serif';"> A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a &quot;work that uses the Library&quot;. Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">However, linking a &quot;work that uses the Library&quot; with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a &quot;work that uses the library&quot;. The executable is therefore covered by this License. Section 6 states terms for distribution of such executables.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">When a &quot;work that uses the Library&quot; uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.)</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600;">6.</span><span style=" font-family:'sans-serif';"> As an exception to the Sections above, you may also combine or link a &quot;work that uses the Library&quot; with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things:</span></p>
|
||||
<ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" font-family:'sans-serif';" style=" margin-top:19px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">a)</span><span style=" font-size:16px;"> Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable &quot;work that uses the Library&quot;, as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.)</span></li>
|
||||
<li style=" font-family:'sans-serif';" style=" margin-top:0px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">b)</span><span style=" font-size:16px;"> Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with.</span></li>
|
||||
<li style=" font-family:'sans-serif';" style=" margin-top:0px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">c)</span><span style=" font-size:16px;"> Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution.</span></li>
|
||||
<li style=" font-family:'sans-serif';" style=" margin-top:0px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">d)</span><span style=" font-size:16px;"> If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place.</span></li>
|
||||
<li style=" font-family:'sans-serif';" style=" margin-top:0px; margin-bottom:19px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">e)</span><span style=" font-size:16px;"> Verify that the user has already received a copy of these materials or that you have already sent this user a copy.</span></li></ul>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">For an executable, the required form of the &quot;work that uses the Library&quot; must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600;">7.</span><span style=" font-family:'sans-serif';"> You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things:</span></p>
|
||||
<ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" font-family:'sans-serif';" style=" margin-top:19px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">a)</span><span style=" font-size:16px;"> Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above.</span></li>
|
||||
<li style=" font-family:'sans-serif';" style=" margin-top:0px; margin-bottom:19px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">b)</span><span style=" font-size:16px;"> Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.</span></li></ul>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600;">8.</span><span style=" font-family:'sans-serif';"> You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600;">9.</span><span style=" font-family:'sans-serif';"> You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600;">10.</span><span style=" font-family:'sans-serif';"> Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600;">11.</span><span style=" font-family:'sans-serif';"> If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600;">12.</span><span style=" font-family:'sans-serif';"> If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600;">13.</span><span style=" font-family:'sans-serif';"> The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and &quot;any later version&quot;, you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600;">14.</span><span style=" font-family:'sans-serif';"> If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600;">NO WARRANTY</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600;">15.</span><span style=" font-family:'sans-serif';"> BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY &quot;AS IS&quot; WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600;">16.</span><span style=" font-family:'sans-serif';"> IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.</span></p>
|
||||
<p style=" margin-top:15px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600; color:#333333;">END OF TERMS AND CONDITIONS</span></p>
|
||||
<p style=" margin-top:15px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="SEC4"></a><span style=" font-family:'sans-serif'; font-weight:600; color:#333333;">H</span><span style=" font-family:'sans-serif'; font-weight:600; color:#333333;">ow to Apply These Terms to Your New Libraries</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License).</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the &quot;copyright&quot; line and a pointer to where the full notice is found.</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace'; font-style:italic;">one line to give the library's name and an idea of what it does.</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">Copyright (C) </span><span style=" font-family:'monospace'; font-style:italic;">year</span><span style=" font-family:'monospace';"> </span><span style=" font-family:'monospace'; font-style:italic;">name of author</span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'monospace'; font-style:italic;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">This library is free software; you can redistribute it and/or</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">modify it under the terms of the GNU Lesser General Public</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">License as published by the Free Software Foundation; either</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">version 2.1 of the License, or (at your option) any later version.</span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'monospace';"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">This library is distributed in the hope that it will be useful,</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">but WITHOUT ANY WARRANTY; without even the implied warranty of</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">Lesser General Public License for more details.</span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'monospace';"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">You should have received a copy of the GNU Lesser General Public</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">License along with this library; if not, write to the Free Software</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">Also add information on how to contact you by electronic and paper mail.</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">You should also get your employer (if you work as a programmer) or your school, if any, to sign a &quot;copyright disclaimer&quot; for the library, if necessary. Here is a sample; alter the names:</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">Yoyodyne, Inc., hereby disclaims all copyright interest in</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">the library `Frob' (a library for tweaking knobs) written</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">by James Random Hacker.</span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'monospace';"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace'; font-style:italic;">signature of Ty Coon</span><span style=" font-family:'monospace';">, 1 April 1990</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">Ty Coon, President of Vice</span></p>
|
||||
<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">That's all there is to it!</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@@ -33,6 +33,7 @@
|
||||
#include <algorithm>
|
||||
#include <QGraphicsScene>
|
||||
#include <QGraphicsSceneMouseEvent>
|
||||
#include <QMenu>
|
||||
|
||||
namespace LimeReport {
|
||||
|
||||
@@ -98,33 +99,8 @@ void BandMarker::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
bool Segment::intersect(Segment value)
|
||||
{
|
||||
return ((value.m_end>=m_begin)&&(value.m_end<=m_end)) ||
|
||||
((value.m_begin>=m_begin)&&(value.m_end>=m_end)) ||
|
||||
((value.m_begin>=m_begin)&&(value.m_end<=m_end)) ||
|
||||
((value.m_begin<m_begin)&&(value.m_end>m_end)) ;
|
||||
}
|
||||
|
||||
qreal Segment::intersectValue(Segment value)
|
||||
{
|
||||
if ((value.m_end>=m_begin)&&(value.m_end<=m_end)){
|
||||
return value.m_end-m_begin;
|
||||
}
|
||||
if ((value.m_begin>=m_begin)&&(value.m_end>=m_end)){
|
||||
return m_end-value.m_begin;
|
||||
}
|
||||
if ((value.m_begin>=m_begin)&&(value.m_end<=m_end)){
|
||||
return value.m_end-value.m_begin;
|
||||
}
|
||||
if ((value.m_begin<m_begin)&&(value.m_end>m_end)){
|
||||
return m_end-m_begin;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
BandDesignIntf::BandDesignIntf(BandsType bandType, const QString &xmlTypeName, QObject* owner, QGraphicsItem *parent) :
|
||||
BaseDesignIntf(xmlTypeName, owner,parent),
|
||||
ItemsContainerDesignInft(xmlTypeName, owner,parent),
|
||||
m_bandType(bandType),
|
||||
m_bandIndex(static_cast<int>(bandType)),
|
||||
m_dataSourceName(""),
|
||||
@@ -146,7 +122,8 @@ BandDesignIntf::BandDesignIntf(BandsType bandType, const QString &xmlTypeName, Q
|
||||
m_startNewPage(false),
|
||||
m_startFromNewPage(false),
|
||||
m_printAlways(false),
|
||||
m_repeatOnEachRow(false)
|
||||
m_repeatOnEachRow(false),
|
||||
m_useAlternateBackgroundColor(false)
|
||||
{
|
||||
setPossibleResizeDirectionFlags(ResizeBottom);
|
||||
setPossibleMoveFlags(TopBotom);
|
||||
@@ -169,6 +146,8 @@ BandDesignIntf::BandDesignIntf(BandsType bandType, const QString &xmlTypeName, Q
|
||||
m_bandNameLabel->setVisible(false);
|
||||
if (scene()) scene()->addItem(m_bandNameLabel);
|
||||
m_alternateBackgroundColor = backgroundColor();
|
||||
connect(this, SIGNAL(propertyObjectNameChanged(QString, QString)),
|
||||
this, SLOT(slotPropertyObjectNameChanged(const QString&,const QString&)));
|
||||
}
|
||||
|
||||
BandDesignIntf::~BandDesignIntf()
|
||||
@@ -183,16 +162,34 @@ BandDesignIntf::~BandDesignIntf()
|
||||
delete m_bandNameLabel;
|
||||
}
|
||||
|
||||
void BandDesignIntf::paint(QPainter *ppainter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||
{
|
||||
if (backgroundColor()!=Qt::white) {
|
||||
ppainter->fillRect(rect(),backgroundColor());
|
||||
int extractItemIndex(const BaseDesignIntf* item){
|
||||
QString objectName = extractClassName(item->metaObject()->className());
|
||||
QString value = item->objectName().right(item->objectName().size() - objectName.size());
|
||||
return value.toInt();
|
||||
}
|
||||
|
||||
QString BandDesignIntf::translateBandName(const BaseDesignIntf* item) const{
|
||||
QString defaultBandName = extractClassName(item->metaObject()->className()).toLatin1()+QString::number(extractItemIndex(item));
|
||||
if (item->objectName().compare(defaultBandName) == 0){
|
||||
return tr(extractClassName(item->metaObject()->className()).toLatin1())+QString::number(extractItemIndex(item));
|
||||
} else {
|
||||
return item->objectName();
|
||||
}
|
||||
if (itemMode()&DesignMode){
|
||||
ppainter->save();
|
||||
QString bandText = objectName();
|
||||
if (parentBand()) bandText+=QLatin1String(" connected to ")+parentBand()->objectName();
|
||||
QFont font("Arial",7*Const::fontFACTOR,-1,true);
|
||||
}
|
||||
|
||||
void BandDesignIntf::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||
{
|
||||
|
||||
if ( !(backgroundColor() == Qt::white && backgroundBrushStyle() == SolidPattern) ) {
|
||||
QBrush brush(backgroundColor(), static_cast<Qt::BrushStyle>(backgroundBrushStyle()));
|
||||
brush.setTransform(painter->worldTransform().inverted());
|
||||
painter->fillRect(rect(), brush);
|
||||
}
|
||||
|
||||
if (itemMode() & DesignMode){
|
||||
painter->save();
|
||||
QString bandText = bandTitle();
|
||||
QFont font("Arial", 7 * Const::fontFACTOR, -1, true);
|
||||
QFontMetrics fontMetrics(font);
|
||||
|
||||
QVector<QRectF> bandNameRects;
|
||||
@@ -204,22 +201,39 @@ void BandDesignIntf::paint(QPainter *ppainter, const QStyleOptionGraphicsItem *o
|
||||
//if (isSelected()) ppainter->setPen(QColor(167,244,167));
|
||||
// else ppainter->setPen(QColor(220,220,220));
|
||||
|
||||
ppainter->setFont(font);
|
||||
painter->setFont(font);
|
||||
for (int i=0;i<bandNameRects.count();i++){
|
||||
QRectF labelRect = bandNameRects[i].adjusted(-2,-2,2,2);
|
||||
if ((labelRect.height())<height() && (childBaseItems().isEmpty()) && !isSelected()){
|
||||
ppainter->setRenderHint(QPainter::Antialiasing);
|
||||
ppainter->setBrush(bandColor());
|
||||
ppainter->setOpacity(Const::BAND_NAME_AREA_OPACITY);
|
||||
ppainter->drawRoundedRect(labelRect,8,8);
|
||||
ppainter->setOpacity(Const::BAND_NAME_TEXT_OPACITY);
|
||||
ppainter->setPen(Qt::black);
|
||||
ppainter->drawText(bandNameRects[i],Qt::AlignHCenter,bandText);
|
||||
painter->setRenderHint(QPainter::Antialiasing);
|
||||
painter->setBrush(bandColor());
|
||||
painter->setOpacity(Const::BAND_NAME_AREA_OPACITY);
|
||||
painter->drawRoundedRect(labelRect,8,8);
|
||||
painter->setOpacity(Const::BAND_NAME_TEXT_OPACITY);
|
||||
painter->setPen(Qt::black);
|
||||
painter->drawText(bandNameRects[i],Qt::AlignHCenter,bandText);
|
||||
}
|
||||
}
|
||||
ppainter->restore();
|
||||
painter->restore();
|
||||
}
|
||||
BaseDesignIntf::paint(ppainter,option,widget);
|
||||
BaseDesignIntf::paint(painter,option,widget);
|
||||
}
|
||||
|
||||
void BandDesignIntf::translateBandsName()
|
||||
{
|
||||
tr("DataBand");
|
||||
tr("DataHeaderBand");
|
||||
tr("DataFooterBand");
|
||||
tr("ReportHeader");
|
||||
tr("ReportFooter");
|
||||
tr("PageHeader");
|
||||
tr("PageFooter");
|
||||
tr("SubDetailBand");
|
||||
tr("SubDetailHeaderBand");
|
||||
tr("SubDetailFooterBand");
|
||||
tr("GroupBandHeader");
|
||||
tr("GroupBandFooter");
|
||||
tr("TearOffBand");
|
||||
}
|
||||
|
||||
BandDesignIntf::BandsType BandDesignIntf::bandType() const
|
||||
@@ -229,8 +243,8 @@ BandDesignIntf::BandsType BandDesignIntf::bandType() const
|
||||
|
||||
QString BandDesignIntf::bandTitle() const
|
||||
{
|
||||
QString result = objectName();
|
||||
if (parentBand()) result +=tr(" connected to ")+parentBand()->objectName();
|
||||
QString result = translateBandName(this);
|
||||
if (parentBand()) result +=tr(" connected to ") + translateBandName(parentBand());
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -249,9 +263,15 @@ void BandDesignIntf::setBandIndex(int value)
|
||||
m_bandIndex=value;
|
||||
}
|
||||
|
||||
void BandDesignIntf::changeBandIndex(int value)
|
||||
void BandDesignIntf::changeBandIndex(int value, bool firstTime)
|
||||
{
|
||||
int indexOffset = value - m_bandIndex;
|
||||
int indexOffset;
|
||||
|
||||
if (firstTime && bandHeader())
|
||||
value += 1;
|
||||
|
||||
indexOffset = value - m_bandIndex;
|
||||
|
||||
foreach(BandDesignIntf* band, childBands()){
|
||||
int newIndex = band->bandIndex()+indexOffset;
|
||||
band->changeBandIndex(newIndex);
|
||||
@@ -313,6 +333,16 @@ bool BandDesignIntf::isConnectedToBand(BandDesignIntf::BandsType bandType) const
|
||||
return false;
|
||||
}
|
||||
|
||||
int BandDesignIntf::maxChildIndex(BandDesignIntf::BandsType bandType) const{
|
||||
int curIndex = bandIndex();
|
||||
foreach(BandDesignIntf* childBand, childBands()){
|
||||
if ( (childBand->bandIndex() > bandIndex()) && (childBand->bandType() < bandType) ){
|
||||
curIndex = std::max(curIndex,childBand->maxChildIndex());
|
||||
}
|
||||
}
|
||||
return curIndex;
|
||||
}
|
||||
|
||||
int BandDesignIntf::maxChildIndex(QSet<BandDesignIntf::BandsType> ignoredBands) const{
|
||||
int curIndex = bandIndex();
|
||||
foreach(BandDesignIntf* childBand, childBands()){
|
||||
@@ -357,6 +387,7 @@ bool BandDesignIntf::canBeSplitted(int height) const
|
||||
|
||||
bool BandDesignIntf::isEmpty() const
|
||||
{
|
||||
if (!isVisible()) return true;
|
||||
foreach(QGraphicsItem* qgItem,childItems()){
|
||||
BaseDesignIntf* item = dynamic_cast<BaseDesignIntf*>(qgItem);
|
||||
if ((item)&&(!item->isEmpty())) return false;
|
||||
@@ -426,6 +457,47 @@ void BandDesignIntf::moveItemsDown(qreal startPos, qreal offset){
|
||||
}
|
||||
}
|
||||
|
||||
void BandDesignIntf::preparePopUpMenu(QMenu &menu)
|
||||
{
|
||||
foreach (QAction* action, menu.actions()) {
|
||||
if (action->text().compare(tr("Bring to top")) == 0 ||
|
||||
action->text().compare(tr("Send to back")) == 0 )
|
||||
action->setEnabled(false);
|
||||
}
|
||||
|
||||
menu.addSeparator();
|
||||
QAction* autoHeightAction = menu.addAction(tr("Auto height"));
|
||||
autoHeightAction->setCheckable(true);
|
||||
autoHeightAction->setChecked(autoHeight());
|
||||
|
||||
QAction* autoSplittableAction = menu.addAction(tr("Splittable"));
|
||||
autoSplittableAction->setCheckable(true);
|
||||
autoSplittableAction->setChecked(isSplittable());
|
||||
}
|
||||
|
||||
void BandDesignIntf::processPopUpAction(QAction *action)
|
||||
{
|
||||
if (action->text().compare(tr("Auto height")) == 0){
|
||||
setProperty("autoHeight",action->isChecked());
|
||||
}
|
||||
if (action->text().compare(tr("Splittable")) == 0){
|
||||
setProperty("splittable",action->isChecked());
|
||||
}
|
||||
}
|
||||
|
||||
void BandDesignIntf::recalcItems(DataSourceManager* dataManager)
|
||||
{
|
||||
foreach(BaseDesignIntf* bi, childBaseItems()){
|
||||
ContentItemDesignIntf* ci = dynamic_cast<ContentItemDesignIntf*>(bi);
|
||||
if (bi){
|
||||
ContentItemDesignIntf* pci = dynamic_cast<ContentItemDesignIntf*>(bi->patternItem());
|
||||
ci->setContent(pci->content());
|
||||
}
|
||||
}
|
||||
|
||||
updateItemSize(dataManager,FirstPass,height());
|
||||
}
|
||||
|
||||
BaseDesignIntf* BandDesignIntf::cloneUpperPart(int height, QObject *owner, QGraphicsItem *parent)
|
||||
{
|
||||
int maxBottom = 0;
|
||||
@@ -547,97 +619,11 @@ void BandDesignIntf::setSplittable(bool value){
|
||||
}
|
||||
}
|
||||
|
||||
bool itemSortContainerLessThen(const PItemSortContainer c1, const PItemSortContainer c2)
|
||||
{
|
||||
VSegment vS1(c1->m_rect),vS2(c2->m_rect);
|
||||
HSegment hS1(c1->m_rect),hS2(c2->m_rect);
|
||||
if (vS1.intersectValue(vS2)>hS1.intersectValue(hS2))
|
||||
return c1->m_rect.x()<c2->m_rect.x();
|
||||
else return c1->m_rect.y()<c2->m_rect.y();
|
||||
}
|
||||
|
||||
bool bandIndexLessThen(const BandDesignIntf* b1, const BandDesignIntf* b2)
|
||||
{
|
||||
return b1->bandIndex()<b2->bandIndex();
|
||||
}
|
||||
|
||||
void BandDesignIntf::snapshotItemsLayout()
|
||||
{
|
||||
m_bandItems.clear();
|
||||
foreach(BaseDesignIntf *childItem,childBaseItems()){
|
||||
m_bandItems.append(PItemSortContainer(new ItemSortContainer(childItem)));
|
||||
}
|
||||
qSort(m_bandItems.begin(),m_bandItems.end(),itemSortContainerLessThen);
|
||||
}
|
||||
|
||||
void BandDesignIntf::arrangeSubItems(RenderPass pass, DataSourceManager *dataManager, ArrangeType type)
|
||||
{
|
||||
bool needArrage=(type==Force);
|
||||
|
||||
foreach (PItemSortContainer item, m_bandItems) {
|
||||
if (item->m_item->isNeedUpdateSize(pass)){
|
||||
item->m_item->updateItemSize(dataManager, pass);
|
||||
needArrage=true;
|
||||
}
|
||||
}
|
||||
|
||||
if (needArrage){
|
||||
//qSort(m_bandItems.begin(),m_bandItems.end(),itemSortContainerLessThen);
|
||||
for (int i=0;i<m_bandItems.count();i++)
|
||||
for (int j=i;j<m_bandItems.count();j++){
|
||||
if ((i!=j) && (m_bandItems[i]->m_item->collidesWithItem(m_bandItems[j]->m_item))){
|
||||
HSegment hS1(m_bandItems[j]->m_rect),hS2(m_bandItems[i]->m_rect);
|
||||
VSegment vS1(m_bandItems[j]->m_rect),vS2(m_bandItems[i]->m_rect);
|
||||
if (m_bandItems[i]->m_rect.bottom()<m_bandItems[i]->m_item->geometry().bottom()){
|
||||
if (hS1.intersectValue(hS2)>vS1.intersectValue(vS2))
|
||||
m_bandItems[j]->m_item->setY(m_bandItems[i]->m_item->y()+m_bandItems[i]->m_item->height()
|
||||
+m_bandItems[j]->m_rect.top()-m_bandItems[i]->m_rect.bottom());
|
||||
|
||||
}
|
||||
if (m_bandItems[i]->m_rect.right()<m_bandItems[i]->m_item->geometry().right()){
|
||||
if (vS1.intersectValue(vS2)>hS1.intersectValue(hS2))
|
||||
m_bandItems[j]->m_item->setX(m_bandItems[i]->m_item->geometry().right()+
|
||||
(m_bandItems[j]->m_rect.x()-m_bandItems[i]->m_rect.right()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(needArrage||pass==FirstPass){
|
||||
int maxBottom = findMaxBottom();
|
||||
foreach(BaseDesignIntf* item,childBaseItems()){
|
||||
ItemDesignIntf* childItem=dynamic_cast<ItemDesignIntf*>(item);
|
||||
if (childItem){
|
||||
if (childItem->stretchToMaxHeight())
|
||||
childItem->setHeight(maxBottom-childItem->geometry().top());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
qreal BandDesignIntf::findMaxBottom()
|
||||
{
|
||||
qreal maxBottom=0;
|
||||
foreach(QGraphicsItem* item,childItems()){
|
||||
BaseDesignIntf* subItem = dynamic_cast<BaseDesignIntf *>(item);
|
||||
if(subItem)
|
||||
if ( subItem->isVisible() && (subItem->geometry().bottom()>maxBottom) )
|
||||
maxBottom=subItem->geometry().bottom();
|
||||
}
|
||||
return maxBottom;
|
||||
}
|
||||
|
||||
qreal BandDesignIntf::findMaxHeight(){
|
||||
qreal maxHeight=0;
|
||||
foreach(QGraphicsItem* item,childItems()){
|
||||
BaseDesignIntf* subItem = dynamic_cast<BaseDesignIntf *>(item);
|
||||
if(subItem)
|
||||
if (subItem->geometry().height()>maxHeight) maxHeight=subItem->geometry().height();
|
||||
}
|
||||
return maxHeight;
|
||||
}
|
||||
|
||||
void BandDesignIntf::trimToMaxHeight(int maxHeight)
|
||||
{
|
||||
foreach(BaseDesignIntf* item,childBaseItems()){
|
||||
@@ -647,7 +633,7 @@ void BandDesignIntf::trimToMaxHeight(int maxHeight)
|
||||
|
||||
void BandDesignIntf::setBandTypeText(const QString &value){
|
||||
m_bandTypeText=value;
|
||||
m_bandNameLabel->updateLabel();
|
||||
m_bandNameLabel->updateLabel(bandTitle());
|
||||
}
|
||||
|
||||
QSet<BandDesignIntf::BandsType> BandDesignIntf::groupBands()
|
||||
@@ -705,7 +691,7 @@ QVariant BandDesignIntf::itemChange(QGraphicsItem::GraphicsItemChange change, co
|
||||
m_bandMarker->update(0,0,
|
||||
m_bandMarker->boundingRect().width(),
|
||||
m_bandMarker->boundingRect().width());
|
||||
m_bandNameLabel->updateLabel();
|
||||
m_bandNameLabel->updateLabel(bandTitle());
|
||||
m_bandNameLabel->setVisible(value.toBool());
|
||||
|
||||
}
|
||||
@@ -746,6 +732,21 @@ void BandDesignIntf::childBandDeleted(QObject *band)
|
||||
m_childBands.removeAt(m_childBands.indexOf(reinterpret_cast<BandDesignIntf*>(band)));
|
||||
}
|
||||
|
||||
bool BandDesignIntf::useAlternateBackgroundColor() const
|
||||
{
|
||||
return m_useAlternateBackgroundColor;
|
||||
}
|
||||
|
||||
void BandDesignIntf::setUseAlternateBackgroundColor(bool useAlternateBackgroundColor)
|
||||
{
|
||||
if (m_useAlternateBackgroundColor != useAlternateBackgroundColor){
|
||||
QColor oldValue = m_useAlternateBackgroundColor;
|
||||
m_useAlternateBackgroundColor=useAlternateBackgroundColor;
|
||||
if (!isLoading())
|
||||
notify("useAlternateBackgroundColor",oldValue,useAlternateBackgroundColor);
|
||||
}
|
||||
}
|
||||
|
||||
QColor BandDesignIntf::alternateBackgroundColor() const
|
||||
{
|
||||
if (metaObject()->indexOfProperty("alternateBackgroundColor")!=-1)
|
||||
@@ -756,7 +757,19 @@ QColor BandDesignIntf::alternateBackgroundColor() const
|
||||
|
||||
void BandDesignIntf::setAlternateBackgroundColor(const QColor &alternateBackgroundColor)
|
||||
{
|
||||
m_alternateBackgroundColor = alternateBackgroundColor;
|
||||
if (m_alternateBackgroundColor != alternateBackgroundColor){
|
||||
QColor oldValue = m_alternateBackgroundColor;
|
||||
m_alternateBackgroundColor=alternateBackgroundColor;
|
||||
if (!isLoading())
|
||||
notify("alternateBackgroundColor",oldValue,alternateBackgroundColor);
|
||||
}
|
||||
}
|
||||
|
||||
void BandDesignIntf::slotPropertyObjectNameChanged(const QString &, const QString& newName)
|
||||
{
|
||||
update();
|
||||
if (m_bandNameLabel)
|
||||
m_bandNameLabel->updateLabel(newName);
|
||||
}
|
||||
|
||||
bool BandDesignIntf::repeatOnEachRow() const
|
||||
@@ -799,6 +812,14 @@ void BandDesignIntf::setStartNewPage(bool startNewPage)
|
||||
m_startNewPage = startNewPage;
|
||||
}
|
||||
|
||||
void BandDesignIntf::setAutoHeight(bool value){
|
||||
if (m_autoHeight != value){
|
||||
m_autoHeight=value;
|
||||
if (!isLoading())
|
||||
notify("autoHeight",!value,value);
|
||||
}
|
||||
}
|
||||
|
||||
bool BandDesignIntf::reprintOnEachPage() const
|
||||
{
|
||||
return m_reprintOnEachPage;
|
||||
@@ -889,6 +910,7 @@ void BandDesignIntf::updateItemSize(DataSourceManager* dataManager, RenderPass p
|
||||
if (borderLines()!=0){
|
||||
spaceBorder += borderLineSize();
|
||||
}
|
||||
restoreLinks();
|
||||
snapshotItemsLayout();
|
||||
arrangeSubItems(pass, dataManager);
|
||||
if (autoHeight()){
|
||||
@@ -902,9 +924,20 @@ void BandDesignIntf::updateItemSize(DataSourceManager* dataManager, RenderPass p
|
||||
BaseDesignIntf::updateItemSize(dataManager, pass, maxHeight);
|
||||
}
|
||||
|
||||
void BandDesignIntf::restoreItems()
|
||||
{
|
||||
foreach(BaseDesignIntf* bi, childBaseItems()){
|
||||
ContentItemDesignIntf* ci = dynamic_cast<ContentItemDesignIntf*>(bi);
|
||||
if (ci){
|
||||
ContentItemDesignIntf* pci = dynamic_cast<ContentItemDesignIntf*>(bi->patternItem());
|
||||
ci->setContent(pci->content());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BandDesignIntf::updateBandNameLabel()
|
||||
{
|
||||
if (m_bandNameLabel) m_bandNameLabel->updateLabel();
|
||||
if (m_bandNameLabel) m_bandNameLabel->updateLabel(bandTitle());
|
||||
}
|
||||
|
||||
QColor BandDesignIntf::selectionColor() const
|
||||
@@ -947,7 +980,7 @@ QRectF BandNameLabel::boundingRect() const
|
||||
return m_rect;
|
||||
}
|
||||
|
||||
void BandNameLabel::updateLabel()
|
||||
void BandNameLabel::updateLabel(const QString& bandName)
|
||||
{
|
||||
QFont font("Arial",7*Const::fontFACTOR,-1,true);
|
||||
QFontMetrics fontMetrics(font);
|
||||
@@ -955,7 +988,7 @@ void BandNameLabel::updateLabel()
|
||||
m_rect = QRectF(
|
||||
m_band->pos().x()+10,
|
||||
m_band->pos().y()-(fontMetrics.height()+10),
|
||||
fontMetrics.width(m_band->bandTitle())+20,fontMetrics.height()+10
|
||||
fontMetrics.width(bandName)+20,fontMetrics.height()+10
|
||||
);
|
||||
update();
|
||||
}
|
||||
|
@@ -31,6 +31,7 @@
|
||||
#define LRBANDDESIGNINTF_H
|
||||
#include "lrbasedesignintf.h"
|
||||
#include "lrdatasourcemanager.h"
|
||||
#include "lritemscontainerdesignitf.h"
|
||||
#include <QObject>
|
||||
|
||||
namespace LimeReport {
|
||||
@@ -73,7 +74,7 @@ public:
|
||||
explicit BandNameLabel(BandDesignIntf* band, QGraphicsItem* parent=0);
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
||||
QRectF boundingRect() const;
|
||||
void updateLabel();
|
||||
void updateLabel(const QString &bandName);
|
||||
void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
|
||||
private:
|
||||
QRectF m_rect;
|
||||
@@ -81,10 +82,7 @@ private:
|
||||
BandDesignIntf* m_band;
|
||||
};
|
||||
|
||||
struct ItemSortContainer;
|
||||
typedef QSharedPointer< ItemSortContainer > PItemSortContainer;
|
||||
|
||||
class BandDesignIntf : public BaseDesignIntf
|
||||
class BandDesignIntf : public ItemsContainerDesignInft
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(bool autoHeight READ autoHeight WRITE setAutoHeight )
|
||||
@@ -92,6 +90,7 @@ class BandDesignIntf : public BaseDesignIntf
|
||||
Q_PROPERTY(bool keepBottomSpace READ keepBottomSpaceOption WRITE setKeepBottomSpaceOption )
|
||||
Q_PROPERTY(QString parentBand READ parentBandName WRITE setParentBandName DESIGNABLE false )
|
||||
Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor)
|
||||
Q_PROPERTY(BrushStyle backgroundBrushStyle READ backgroundBrushStyle WRITE setBackgroundBrushStyle)
|
||||
Q_PROPERTY(bool printIfEmpty READ printIfEmpty WRITE setPrintIfEmpty)
|
||||
Q_ENUMS(BandColumnsLayoutType)
|
||||
friend class BandMarker;
|
||||
@@ -121,18 +120,21 @@ public:
|
||||
BandDesignIntf(BandsType bandType, const QString& xmlTypeName, QObject* owner = 0, QGraphicsItem* parent=0);
|
||||
~BandDesignIntf();
|
||||
|
||||
void paint(QPainter *ppainter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
||||
void translateBandsName();
|
||||
virtual BandsType bandType() const;
|
||||
virtual QString bandTitle() const;
|
||||
virtual QIcon bandIcon() const;
|
||||
virtual bool isUnique() const;
|
||||
void updateItemSize(DataSourceManager *dataManager, RenderPass pass=FirstPass, int maxHeight=0);
|
||||
void restoreItems();
|
||||
void recalcItems(DataSourceManager* dataManager);
|
||||
void updateBandNameLabel();
|
||||
|
||||
virtual QColor selectionColor() const;
|
||||
int bandIndex() const;
|
||||
void setBandIndex(int value);
|
||||
void changeBandIndex(int value);
|
||||
void changeBandIndex(int value, bool firstTime = false);
|
||||
void setBandType(BandsType value){m_bandType=value;}
|
||||
|
||||
QString datasourceName();
|
||||
@@ -152,6 +154,7 @@ public:
|
||||
bool isConnectedToBand(BandDesignIntf::BandsType bandType) const;
|
||||
|
||||
int minChildIndex(BandsType bandType);
|
||||
int maxChildIndex(BandDesignIntf::BandsType bandType) const;
|
||||
int maxChildIndex(QSet<BandsType> ignoredBands = QSet<BandDesignIntf::BandsType>()) const;
|
||||
|
||||
BandDesignIntf* parentBand() const {return m_parentBand;}
|
||||
@@ -166,6 +169,7 @@ public:
|
||||
virtual bool isHeader() const {return false;}
|
||||
virtual bool isGroupHeader() const {return false;}
|
||||
virtual bool isData() const {return false;}
|
||||
virtual int bandNestingLevel(){return 0;}
|
||||
bool isBand(){return true;}
|
||||
|
||||
void setTryToKeepTogether(bool value);
|
||||
@@ -206,7 +210,7 @@ public:
|
||||
bool startNewPage() const;
|
||||
void setStartNewPage(bool startNewPage);
|
||||
|
||||
void setAutoHeight(bool value){m_autoHeight=value;}
|
||||
void setAutoHeight(bool value);
|
||||
bool autoHeight(){return m_autoHeight;}
|
||||
|
||||
bool startFromNewPage() const;
|
||||
@@ -218,14 +222,12 @@ public:
|
||||
void setRepeatOnEachRow(bool repeatOnEachRow);
|
||||
QColor alternateBackgroundColor() const;
|
||||
void setAlternateBackgroundColor(const QColor &alternateBackgroundColor);
|
||||
|
||||
bool useAlternateBackgroundColor() const;
|
||||
void setUseAlternateBackgroundColor(bool useAlternateBackgroundColor);
|
||||
void replaceGroupsFunction(BandDesignIntf *band);
|
||||
signals:
|
||||
void bandRendered(BandDesignIntf* band);
|
||||
void bandRendered(BandDesignIntf* band);
|
||||
protected:
|
||||
void snapshotItemsLayout();
|
||||
void arrangeSubItems(RenderPass pass, DataSourceManager *dataManager, ArrangeType type = AsNeeded);
|
||||
qreal findMaxBottom();
|
||||
qreal findMaxHeight();
|
||||
void trimToMaxHeight(int maxHeight);
|
||||
void setBandTypeText(const QString& value);
|
||||
QString bandTypeText(){return m_bandTypeText;}
|
||||
@@ -243,8 +245,12 @@ protected:
|
||||
void setColumnsCount(int value);
|
||||
void setColumnsFillDirection(BandColumnsLayoutType value);
|
||||
void moveItemsDown(qreal startPos, qreal offset);
|
||||
void preparePopUpMenu(QMenu &menu);
|
||||
void processPopUpAction(QAction *action);
|
||||
QString translateBandName(const BaseDesignIntf *item) const;
|
||||
private slots:
|
||||
void childBandDeleted(QObject* band);
|
||||
void slotPropertyObjectNameChanged(const QString&,const QString&);
|
||||
private:
|
||||
QString m_bandTypeText;
|
||||
BandsType m_bandType;
|
||||
@@ -273,7 +279,8 @@ private:
|
||||
bool m_printAlways;
|
||||
bool m_repeatOnEachRow;
|
||||
QMap<QString,BaseDesignIntf*> m_slicedItems;
|
||||
QColor m_alternateBackgroundColor;
|
||||
QColor m_alternateBackgroundColor;
|
||||
bool m_useAlternateBackgroundColor;
|
||||
};
|
||||
|
||||
class DataBandDesignIntf : public BandDesignIntf{
|
||||
@@ -283,37 +290,7 @@ public:
|
||||
DataBandDesignIntf(BandsType bandType, QString xmlTypeName, QObject* owner = 0, QGraphicsItem* parent=0);
|
||||
};
|
||||
|
||||
class Segment{
|
||||
public:
|
||||
Segment(qreal segmentStart,qreal segmentEnd):m_begin(segmentStart),m_end(segmentEnd){}
|
||||
bool intersect(Segment value);
|
||||
qreal intersectValue(Segment value);
|
||||
private:
|
||||
qreal m_begin;
|
||||
qreal m_end;
|
||||
};
|
||||
|
||||
class VSegment : public Segment{
|
||||
public:
|
||||
VSegment(QRectF rect):Segment(rect.top(),rect.bottom()){}
|
||||
};
|
||||
|
||||
struct HSegment :public Segment{
|
||||
public:
|
||||
HSegment(QRectF rect):Segment(rect.left(),rect.right()){}
|
||||
};
|
||||
|
||||
struct ItemSortContainer {
|
||||
QRectF m_rect;
|
||||
BaseDesignIntf * m_item;
|
||||
ItemSortContainer(BaseDesignIntf *item){
|
||||
m_item=item;
|
||||
m_rect=item->geometry();
|
||||
}
|
||||
};
|
||||
|
||||
bool itemSortContainerLessThen(const PItemSortContainer c1, const PItemSortContainer c2);
|
||||
bool bandIndexLessThen(const BandDesignIntf* b1, const BandDesignIntf* b2);
|
||||
|
||||
}
|
||||
} // namespace LimeReport
|
||||
#endif // LRBANDDESIGNINTF_H
|
||||
|
@@ -34,16 +34,18 @@
|
||||
#include "lrreportdesignwidget.h"
|
||||
#include "qgraphicsitem.h"
|
||||
#include "lrdesignelementsfactory.h"
|
||||
|
||||
#include "lrhorizontallayout.h"
|
||||
#include "serializators/lrstorageintf.h"
|
||||
#include "serializators/lrxmlreader.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <QMetaObject>
|
||||
#include <QGraphicsSceneMouseEvent>
|
||||
#include <QApplication>
|
||||
#include <QDialog>
|
||||
#include <QVBoxLayout>
|
||||
#include <QMenu>
|
||||
#include <QClipboard>
|
||||
|
||||
namespace LimeReport
|
||||
{
|
||||
@@ -64,19 +66,20 @@ BaseDesignIntf::BaseDesignIntf(const QString &storageTypeName, QObject *owner, Q
|
||||
m_BGMode(OpaqueMode),
|
||||
m_opacity(100),
|
||||
m_borderLinesFlags(0),
|
||||
m_hintFrame(0),
|
||||
m_storageTypeName(storageTypeName),
|
||||
m_itemMode(DesignMode),
|
||||
m_objectState(ObjectCreated),
|
||||
m_selectionMarker(0),
|
||||
m_joinMarker(0),
|
||||
m_backgroundBrush(Solid),
|
||||
m_backgroundBrushcolor(Qt::white),
|
||||
m_backgroundBrushStyle(SolidPattern),
|
||||
m_backgroundColor(Qt::white),
|
||||
m_margin(4),
|
||||
m_itemAlign(DesignedItemAlign),
|
||||
m_changingItemAlign(false),
|
||||
m_borderColor(Qt::black),
|
||||
m_reportSettings(0)
|
||||
m_reportSettings(0),
|
||||
m_patternName(""),
|
||||
m_patternItem(0)
|
||||
{
|
||||
setGeometry(QRectF(0, 0, m_width, m_height));
|
||||
if (BaseDesignIntf *item = dynamic_cast<BaseDesignIntf *>(parent)) {
|
||||
@@ -85,9 +88,6 @@ BaseDesignIntf::BaseDesignIntf(const QString &storageTypeName, QObject *owner, Q
|
||||
m_font = QFont("Arial",10);
|
||||
}
|
||||
initFlags();
|
||||
|
||||
|
||||
//connect(this,SIGNAL(objectNameChanged(QString)),this,SLOT(slotObjectNameChanged(QString)));
|
||||
}
|
||||
|
||||
QRectF BaseDesignIntf::boundingRect() const
|
||||
@@ -124,21 +124,23 @@ QString BaseDesignIntf::parentReportItemName() const
|
||||
else return "";
|
||||
}
|
||||
|
||||
void BaseDesignIntf::setBackgroundBrushMode(BaseDesignIntf::BrushMode value)
|
||||
void BaseDesignIntf::setBackgroundBrushStyle(BrushStyle value)
|
||||
{
|
||||
if ( value != m_backgroundBrush ){
|
||||
m_backgroundBrush=value;
|
||||
if ( value != m_backgroundBrushStyle ){
|
||||
BrushStyle oldValue = m_backgroundBrushStyle;
|
||||
m_backgroundBrushStyle=value;
|
||||
if (!isLoading()) update();
|
||||
notify("backgroundBrushStyle", static_cast<int>(oldValue), static_cast<int>(value));
|
||||
}
|
||||
}
|
||||
|
||||
void BaseDesignIntf::setBackgroundColor(QColor value)
|
||||
{
|
||||
if (value != m_backgroundBrushcolor){
|
||||
QColor oldValue = m_backgroundBrushcolor;
|
||||
m_backgroundBrushcolor=value;
|
||||
if (value != m_backgroundColor){
|
||||
QColor oldValue = m_backgroundColor;
|
||||
m_backgroundColor=value;
|
||||
if (!isLoading()) update();
|
||||
notify("backgroundColor",oldValue,m_backgroundBrushcolor);
|
||||
notify("backgroundColor", oldValue, value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,6 +244,31 @@ QFont BaseDesignIntf::transformToSceneFont(const QFont& value) const
|
||||
return f;
|
||||
}
|
||||
|
||||
QString BaseDesignIntf::expandDataFields(QString context, ExpandType expandType, DataSourceManager* dataManager)
|
||||
{
|
||||
ScriptEngineManager& sm = ScriptEngineManager::instance();
|
||||
if (sm.dataManager() != dataManager) sm.setDataManager(dataManager);
|
||||
return sm.expandDataFields(context, expandType, m_varValue, this);
|
||||
}
|
||||
|
||||
QString BaseDesignIntf::expandUserVariables(QString context, RenderPass pass, ExpandType expandType, DataSourceManager* dataManager)
|
||||
{
|
||||
|
||||
ScriptEngineManager& sm = ScriptEngineManager::instance();
|
||||
if (sm.dataManager() != dataManager) sm.setDataManager(dataManager);
|
||||
return sm.expandUserVariables(context, pass, expandType, m_varValue);
|
||||
|
||||
}
|
||||
|
||||
QString BaseDesignIntf::expandScripts(QString context, DataSourceManager* dataManager)
|
||||
{
|
||||
|
||||
ScriptEngineManager& sm = ScriptEngineManager::instance();
|
||||
if (sm.dataManager() != dataManager) sm.setDataManager(dataManager);
|
||||
return sm.expandScripts(context,m_varValue,this);
|
||||
|
||||
}
|
||||
|
||||
void BaseDesignIntf::setupPainter(QPainter *painter) const
|
||||
{
|
||||
if (!painter) {
|
||||
@@ -352,7 +379,6 @@ void BaseDesignIntf::paint(QPainter *ppainter, const QStyleOptionGraphicsItem *o
|
||||
Q_UNUSED(option);
|
||||
Q_UNUSED(widget);
|
||||
setupPainter(ppainter);
|
||||
|
||||
drawBorder(ppainter, rect());
|
||||
if (isSelected()) {drawSelection(ppainter, rect());}
|
||||
drawResizeZone(ppainter);
|
||||
@@ -368,24 +394,28 @@ QColor calcColor(QColor color){
|
||||
return Qt::white;
|
||||
else
|
||||
return Qt::black;
|
||||
};
|
||||
}
|
||||
|
||||
void BaseDesignIntf::prepareRect(QPainter *ppainter, const QStyleOptionGraphicsItem * /*option*/, QWidget * /*widget*/)
|
||||
void BaseDesignIntf::prepareRect(QPainter *painter, const QStyleOptionGraphicsItem * /*option*/, QWidget * /*widget*/)
|
||||
{
|
||||
ppainter->save();
|
||||
painter->save();
|
||||
|
||||
QBrush brush(m_backgroundColor,static_cast<Qt::BrushStyle>(m_backgroundBrushStyle));
|
||||
brush.setTransform(painter->worldTransform().inverted());
|
||||
|
||||
if (isSelected() && (opacity() == 100) && (m_BGMode!=TransparentMode)) {
|
||||
ppainter->fillRect(rect(), QBrush(QColor(m_backgroundBrushcolor)));
|
||||
painter->fillRect(rect(), brush);
|
||||
}
|
||||
else {
|
||||
if (m_BGMode == OpaqueMode) {
|
||||
ppainter->setOpacity(qreal(m_opacity) / 100);
|
||||
ppainter->fillRect(rect(), QBrush(m_backgroundBrushcolor));
|
||||
painter->setOpacity(qreal(m_opacity) / 100);
|
||||
painter->fillRect(rect(), brush);
|
||||
} else if (itemMode() & DesignMode){
|
||||
ppainter->setOpacity(0.1);
|
||||
ppainter->fillRect(rect(), QBrush(QPixmap(":/report/empty")));
|
||||
painter->setOpacity(0.1);
|
||||
painter->fillRect(rect(), QBrush(QPixmap(":/report/images/empty")));
|
||||
}
|
||||
}
|
||||
ppainter->restore();
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
void BaseDesignIntf::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
||||
@@ -672,6 +702,26 @@ void BaseDesignIntf::turnOnSelectionMarker(bool value)
|
||||
}
|
||||
}
|
||||
|
||||
QString BaseDesignIntf::patternName() const
|
||||
{
|
||||
return (m_patternName.isEmpty()) ? objectName() : m_patternName;
|
||||
}
|
||||
|
||||
void BaseDesignIntf::setPatternName(const QString &patternName)
|
||||
{
|
||||
m_patternName = patternName;
|
||||
}
|
||||
|
||||
BaseDesignIntf* BaseDesignIntf::patternItem() const
|
||||
{
|
||||
return m_patternItem;
|
||||
}
|
||||
|
||||
void BaseDesignIntf::setPatternItem(BaseDesignIntf *patternItem)
|
||||
{
|
||||
m_patternItem = patternItem;
|
||||
}
|
||||
|
||||
ReportSettings *BaseDesignIntf::reportSettings() const
|
||||
{
|
||||
return m_reportSettings;
|
||||
@@ -987,6 +1037,19 @@ void BaseDesignIntf::parentChangedEvent(BaseDesignIntf *)
|
||||
|
||||
}
|
||||
|
||||
void BaseDesignIntf::restoreLinks()
|
||||
{
|
||||
#ifdef HAVE_QT5
|
||||
foreach(QObject * child, children()) {
|
||||
#else
|
||||
foreach(QObject * child, QObject::children()) {
|
||||
#endif
|
||||
BaseDesignIntf *childItem = dynamic_cast<BaseDesignIntf *>(child);
|
||||
if (childItem) {childItem->restoreLinks();}
|
||||
}
|
||||
restoreLinksEvent();
|
||||
}
|
||||
|
||||
QPainterPath BaseDesignIntf::shape() const
|
||||
{
|
||||
QPainterPath path;
|
||||
@@ -1098,6 +1161,56 @@ void BaseDesignIntf::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
|
||||
QGraphicsItem::mouseDoubleClickEvent(event);
|
||||
}
|
||||
|
||||
void BaseDesignIntf::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
||||
{
|
||||
PageDesignIntf* page = dynamic_cast<PageDesignIntf*>(scene());
|
||||
if (!page->selectedItems().contains(this)){
|
||||
page->clearSelection();
|
||||
this->setSelected(true);
|
||||
}
|
||||
QMenu menu;
|
||||
QAction* copyAction = menu.addAction(QIcon(":/report/images/copy.png"), tr("Copy"));
|
||||
copyAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_C));
|
||||
QAction* cutAction = menu.addAction(QIcon(":/report//images/cut"), tr("Cut"));
|
||||
cutAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_X));
|
||||
QAction* pasteAction = menu.addAction(QIcon(":/report/images/paste.png"), tr("Paste"));
|
||||
pasteAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_V));
|
||||
pasteAction->setEnabled(false);
|
||||
QClipboard *clipboard = QApplication::clipboard();
|
||||
ItemsReaderIntf::Ptr reader = StringXMLreader::create(clipboard->text());
|
||||
if (reader->first() && reader->itemType() == "Object"){
|
||||
pasteAction->setEnabled(true);
|
||||
}
|
||||
menu.addSeparator();
|
||||
QAction* brinToTopAction = menu.addAction(QIcon(":/report//images/bringToTop"), tr("Bring to top"));
|
||||
QAction* sendToBackAction = menu.addAction(QIcon(":/report//images/sendToBack"), tr("Send to back"));
|
||||
menu.addSeparator();
|
||||
QAction* noBordersAction = menu.addAction(QIcon(":/report//images/noLines"), tr("No borders"));
|
||||
QAction* allBordersAction = menu.addAction(QIcon(":/report//images/allLines"), tr("All borders"));
|
||||
preparePopUpMenu(menu);
|
||||
QAction* a = menu.exec(event->screenPos());
|
||||
if (a){
|
||||
if (a == cutAction)
|
||||
{
|
||||
page->cut();
|
||||
return;
|
||||
}
|
||||
if (a == copyAction)
|
||||
page->copy();
|
||||
if (a == pasteAction)
|
||||
page->paste();
|
||||
if (a == brinToTopAction)
|
||||
page->bringToFront();
|
||||
if (a == sendToBackAction)
|
||||
page->sendToBack();
|
||||
if (a == noBordersAction)
|
||||
page->setBorders(BaseDesignIntf::NoLine);
|
||||
if (a == allBordersAction)
|
||||
page->setBorders(BaseDesignIntf::AllLines);
|
||||
processPopUpAction(a);
|
||||
}
|
||||
}
|
||||
|
||||
int BaseDesignIntf::possibleMoveDirectionFlags() const
|
||||
{
|
||||
return m_possibleMoveDirectionFlags;
|
||||
@@ -1229,6 +1342,8 @@ void BaseDesignIntf::collectionLoadFinished(const QString &collectionName)
|
||||
BaseDesignIntf *BaseDesignIntf::cloneItem(ItemMode mode, QObject *owner, QGraphicsItem *parent)
|
||||
{
|
||||
BaseDesignIntf *clone = cloneItemWOChild(mode, owner, parent);
|
||||
clone->setPatternName(this->objectName());
|
||||
clone->setPatternItem(this);
|
||||
#ifdef HAVE_QT5
|
||||
foreach(QObject * child, children()) {
|
||||
#else
|
||||
@@ -1424,8 +1539,7 @@ BaseDesignIntf *Marker::object() const
|
||||
return m_object;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
} //namespace LimeReport
|
||||
|
||||
|
||||
|
||||
|
@@ -34,6 +34,7 @@
|
||||
#include <QGraphicsItem>
|
||||
#include <QtGui>
|
||||
#include <QtXml>
|
||||
#include <QMenu>
|
||||
#include "lrcollection.h"
|
||||
#include "lrglobal.h"
|
||||
#include "serializators/lrstorageintf.h"
|
||||
@@ -50,7 +51,7 @@ class BaseDesignIntf;
|
||||
|
||||
class Marker : public QGraphicsItem{
|
||||
public:
|
||||
Marker(QGraphicsItem* parent=0):QGraphicsItem(parent){}
|
||||
Marker(QGraphicsItem* parent=0):QGraphicsItem(parent),m_object(NULL){}
|
||||
QRectF boundingRect() const;
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *);
|
||||
void setRect(QRectF rect){prepareGeometryChange();m_rect=rect;}
|
||||
@@ -76,6 +77,7 @@ protected:
|
||||
};
|
||||
|
||||
class DataSourceManager;
|
||||
class ReportRender;
|
||||
|
||||
class BaseDesignIntf :
|
||||
public QObject, public QGraphicsItem, public ICollectionContainer, public ObjectLoadingStateIntf {
|
||||
@@ -83,7 +85,7 @@ class BaseDesignIntf :
|
||||
Q_INTERFACES(QGraphicsItem)
|
||||
Q_ENUMS(BGMode)
|
||||
Q_ENUMS(Qt::BrushStyle)
|
||||
Q_ENUMS(BrushMode)
|
||||
Q_ENUMS(BrushStyle)
|
||||
Q_ENUMS(ItemAlign)
|
||||
Q_FLAGS(BorderLines)
|
||||
Q_PROPERTY(QRectF geometry READ geometry WRITE setGeometryProperty NOTIFY geometryChanged)
|
||||
@@ -94,10 +96,25 @@ class BaseDesignIntf :
|
||||
Q_PROPERTY(int borderLineSize READ borderLineSize WRITE setBorderLineSize)
|
||||
Q_PROPERTY(bool isVisible READ isVisible WRITE setItemVisible DESIGNABLE false)
|
||||
Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor)
|
||||
|
||||
friend class ReportRender;
|
||||
public:
|
||||
enum BGMode { TransparentMode,OpaqueMode};
|
||||
enum BrushMode{Solid,None};
|
||||
enum BGMode { TransparentMode, OpaqueMode};
|
||||
|
||||
enum BrushStyle{ NoBrush,
|
||||
SolidPattern,
|
||||
Dense1Pattern,
|
||||
Dense2Pattern,
|
||||
Dense3Pattern,
|
||||
Dense4Pattern,
|
||||
Dense5Pattern,
|
||||
Dense6Pattern,
|
||||
Dense7Pattern,
|
||||
HorPattern,
|
||||
VerPattern,
|
||||
CrossPattern,
|
||||
BDiagPattern,
|
||||
FDiagPattern };
|
||||
|
||||
enum ResizeFlags { Fixed = 0,
|
||||
ResizeLeft = 1,
|
||||
ResizeRight = 2,
|
||||
@@ -109,13 +126,17 @@ public:
|
||||
TopBotom=2,
|
||||
All=3
|
||||
};
|
||||
enum BorderSide { TopLine = 1,
|
||||
BottomLine = 2,
|
||||
LeftLine = 4,
|
||||
RightLine = 8
|
||||
enum BorderSide {
|
||||
NoLine = 0,
|
||||
TopLine = 1,
|
||||
BottomLine = 2,
|
||||
LeftLine = 4,
|
||||
RightLine = 8,
|
||||
AllLines = 15
|
||||
};
|
||||
enum ObjectState {ObjectLoading, ObjectLoaded, ObjectCreated};
|
||||
enum ItemAlign {LeftItemAlign,RightItemAlign,CenterItemAlign,ParentWidthItemAlign,DesignedItemAlign};
|
||||
// enum ExpandType {EscapeSymbols, NoEscapeSymbols, ReplaceHTMLSymbols};
|
||||
Q_DECLARE_FLAGS(BorderLines, BorderSide)
|
||||
Q_DECLARE_FLAGS(ItemMode,ItemModes)
|
||||
friend class SelectionMarker;
|
||||
@@ -123,13 +144,13 @@ public:
|
||||
BaseDesignIntf(const QString& storageTypeName, QObject* owner = 0, QGraphicsItem* parent = 0);
|
||||
virtual ~BaseDesignIntf();
|
||||
|
||||
void setParentReportItem(const QString& value);
|
||||
void setParentReportItem(const QString& value);
|
||||
QString parentReportItemName() const;
|
||||
|
||||
BrushMode backgroundBrushMode() const {return m_backgroundBrush;}
|
||||
void setBackgroundBrushMode(BrushMode value);
|
||||
QColor backgroundColor() const {return m_backgroundBrushcolor;}
|
||||
void setBackgroundColor(QColor value);
|
||||
BrushStyle backgroundBrushStyle() const {return m_backgroundBrushStyle;}
|
||||
void setBackgroundBrushStyle(BrushStyle value);
|
||||
QColor backgroundColor() const {return m_backgroundColor;}
|
||||
void setBackgroundColor(QColor value);
|
||||
|
||||
QPen pen() const;
|
||||
void setPen(QPen& pen);
|
||||
@@ -154,7 +175,7 @@ public:
|
||||
virtual QSizeF sizeMM() const;
|
||||
|
||||
void paint(QPainter* ppainter, const QStyleOptionGraphicsItem* option, QWidget* widget);
|
||||
void prepareRect(QPainter* ppainter, const QStyleOptionGraphicsItem*, QWidget*);
|
||||
void prepareRect(QPainter* painter, const QStyleOptionGraphicsItem*, QWidget*);
|
||||
virtual QPainterPath shape() const;
|
||||
|
||||
void setFixedPos(bool fixedPos);
|
||||
@@ -245,10 +266,14 @@ public:
|
||||
QColor borderColor() const;
|
||||
void setBorderColor(const QColor &borderColor);
|
||||
void setItemVisible(const bool& value);
|
||||
virtual bool canContainChildren(){ return false;}
|
||||
virtual bool canContainChildren(){ return false;}
|
||||
ReportSettings* reportSettings() const;
|
||||
void setReportSettings(ReportSettings *reportSettings);
|
||||
void setZValueProperty(qreal value);
|
||||
QString patternName() const;
|
||||
void setPatternName(const QString &patternName);
|
||||
BaseDesignIntf* patternItem() const;
|
||||
void setPatternItem(BaseDesignIntf* patternItem);
|
||||
|
||||
Q_INVOKABLE QString setItemWidth(qreal width);
|
||||
Q_INVOKABLE QString setItemHeight(qreal height);
|
||||
@@ -258,6 +283,7 @@ public:
|
||||
Q_INVOKABLE qreal getItemPosY();
|
||||
Q_INVOKABLE QString setItemPosX(qreal xValue);
|
||||
Q_INVOKABLE QString setItemPosY(qreal yValue);
|
||||
|
||||
protected:
|
||||
|
||||
//ICollectionContainer
|
||||
@@ -274,6 +300,7 @@ protected:
|
||||
void mouseMoveEvent(QGraphicsSceneMouseEvent* event);
|
||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
|
||||
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
|
||||
void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
|
||||
|
||||
virtual void geometryChangedEvent(QRectF newRect, QRectF oldRect);
|
||||
virtual QPen borderPen(BorderSide side) const;
|
||||
@@ -283,6 +310,8 @@ protected:
|
||||
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value);
|
||||
virtual void childAddedEvent(BaseDesignIntf* child);
|
||||
virtual void parentChangedEvent(BaseDesignIntf*);
|
||||
void restoreLinks();
|
||||
virtual void restoreLinksEvent(){}
|
||||
|
||||
void drawTopLine(QPainter *painter, QRectF rect) const;
|
||||
void drawBootomLine(QPainter *painter, QRectF rect) const;
|
||||
@@ -305,6 +334,16 @@ protected:
|
||||
|
||||
virtual bool drawDesignBorders() const {return true;}
|
||||
virtual QColor selectionMarkerColor(){ return Const::SELECTION_COLOR;}
|
||||
|
||||
QString expandUserVariables(QString context, RenderPass pass, ExpandType expandType, DataSourceManager *dataManager);
|
||||
QString expandDataFields(QString context, ExpandType expandType, DataSourceManager *dataManager);
|
||||
QString expandScripts(QString context, DataSourceManager *dataManager);
|
||||
|
||||
QVariant m_varValue;
|
||||
|
||||
virtual void preparePopUpMenu(QMenu& menu){Q_UNUSED(menu)}
|
||||
virtual void processPopUpAction(QAction* action){Q_UNUSED(action)}
|
||||
|
||||
private:
|
||||
void updateSelectionMarker();
|
||||
int resizeDirectionFlags(QPointF position);
|
||||
@@ -314,13 +353,13 @@ private:
|
||||
void turnOnSelectionMarker(bool value);
|
||||
private:
|
||||
QPointF m_startPos;
|
||||
//QPointF m_startScenePos;
|
||||
int m_resizeHandleSize;
|
||||
int m_selectionPenSize;
|
||||
int m_possibleResizeDirectionFlags;
|
||||
int m_possibleMoveDirectionFlags;
|
||||
int m_resizeDirectionFlags;
|
||||
qreal m_width, m_height;
|
||||
qreal m_width;
|
||||
qreal m_height;
|
||||
QPen m_pen;
|
||||
QFont m_font;
|
||||
QColor m_fontColor;
|
||||
@@ -342,7 +381,6 @@ private:
|
||||
QRectF m_rightRect;
|
||||
|
||||
QVector<QRectF*> m_resizeAreas;
|
||||
QFrame* m_hintFrame;
|
||||
QString m_storageTypeName;
|
||||
ItemMode m_itemMode;
|
||||
|
||||
@@ -350,8 +388,9 @@ private:
|
||||
SelectionMarker* m_selectionMarker;
|
||||
Marker* m_joinMarker;
|
||||
|
||||
BrushMode m_backgroundBrush;
|
||||
QColor m_backgroundBrushcolor;
|
||||
BrushStyle m_backgroundBrushStyle;
|
||||
QColor m_backgroundColor;
|
||||
|
||||
RenderPass m_currentPass;
|
||||
int m_margin;
|
||||
QString m_itemTypeName;
|
||||
@@ -359,6 +398,8 @@ private:
|
||||
bool m_changingItemAlign;
|
||||
QColor m_borderColor;
|
||||
ReportSettings* m_reportSettings;
|
||||
QString m_patternName;
|
||||
BaseDesignIntf* m_patternItem;
|
||||
signals:
|
||||
void geometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry);
|
||||
void posChanged(QObject* object, QPointF newPos, QPointF oldPos);
|
||||
@@ -371,6 +412,10 @@ signals:
|
||||
void propertyesChanged(QVector<QString> propertyNames);
|
||||
void itemAlignChanged(BaseDesignIntf* item, const ItemAlign& oldValue, const ItemAlign& newValue);
|
||||
void itemVisibleHasChanged(BaseDesignIntf* item);
|
||||
|
||||
void beforeRender();
|
||||
void afterData();
|
||||
void afterRender();
|
||||
};
|
||||
|
||||
} //namespace LimeReport
|
||||
|
@@ -299,7 +299,7 @@ int ModelToDataSource::columnCount()
|
||||
|
||||
QString ModelToDataSource::columnNameByIndex(int columnIndex)
|
||||
{
|
||||
if (isInvalid()) return "";
|
||||
if (isInvalid()) return "";
|
||||
QString result = m_model->headerData(columnIndex,Qt::Horizontal, Qt::UserRole).isValid()?
|
||||
m_model->headerData(columnIndex,Qt::Horizontal, Qt::UserRole).toString():
|
||||
m_model->headerData(columnIndex,Qt::Horizontal).toString();
|
||||
@@ -350,12 +350,14 @@ void ModelToDataSource::slotModelDestroed()
|
||||
|
||||
ConnectionDesc::ConnectionDesc(QSqlDatabase db, QObject *parent)
|
||||
: QObject(parent), m_connectionName(db.connectionName()), m_connectionHost(db.hostName()), m_connectionDriver(db.driverName()),
|
||||
m_databaseName(db.databaseName()), m_user(db.userName()), m_password(db.password()), m_autoconnect(false)
|
||||
m_databaseName(db.databaseName()), m_user(db.userName()), m_password(db.password()), m_autoconnect(false),
|
||||
m_internal(false), m_keepDBCredentials(true)
|
||||
{}
|
||||
|
||||
ConnectionDesc::ConnectionDesc(QObject *parent)
|
||||
:QObject(parent),m_connectionName(""),m_connectionHost(""),m_connectionDriver(""),
|
||||
m_databaseName(""), m_user(""), m_password(""), m_autoconnect(false)
|
||||
m_databaseName(""), m_user(""), m_password(""), m_autoconnect(false),
|
||||
m_internal(false), m_keepDBCredentials(true)
|
||||
{}
|
||||
|
||||
ConnectionDesc::Ptr ConnectionDesc::create(QSqlDatabase db, QObject *parent)
|
||||
@@ -369,6 +371,36 @@ void ConnectionDesc::setName(const QString &value)
|
||||
m_connectionName=value;
|
||||
}
|
||||
|
||||
bool ConnectionDesc::isEqual(const QSqlDatabase &db)
|
||||
{
|
||||
return (db.databaseName() == m_databaseName) &&
|
||||
(db.driverName() == m_connectionDriver) &&
|
||||
(db.hostName() == m_connectionHost) &&
|
||||
(db.connectionName() == m_connectionName) &&
|
||||
(db.userName() == m_user) &&
|
||||
(db.password() == m_password);
|
||||
}
|
||||
|
||||
QString ConnectionDesc::connectionNameForUser(const QString &connectionName)
|
||||
{
|
||||
return connectionName.compare(QSqlDatabase::defaultConnection) == 0 ? tr("defaultConnection") : connectionName;
|
||||
}
|
||||
|
||||
QString ConnectionDesc::connectionNameForReport(const QString &connectionName)
|
||||
{
|
||||
return connectionName.compare(tr("defaultConnection")) == 0 ? QSqlDatabase::defaultConnection : connectionName;
|
||||
}
|
||||
|
||||
bool ConnectionDesc::keepDBCredentials() const
|
||||
{
|
||||
return m_keepDBCredentials;
|
||||
}
|
||||
|
||||
void ConnectionDesc::setKeepDBCredentials(bool keepDBCredentals)
|
||||
{
|
||||
m_keepDBCredentials = keepDBCredentals;
|
||||
}
|
||||
|
||||
QueryDesc::QueryDesc(QString queryName, QString queryText, QString connection)
|
||||
:m_queryName(queryName), m_queryText(queryText), m_connectionName(connection)
|
||||
{}
|
||||
@@ -389,7 +421,7 @@ void SubQueryHolder::setMasterDatasource(const QString &value)
|
||||
void SubQueryHolder::extractParams()
|
||||
{
|
||||
if (!dataManager()->containsDatasource(m_masterDatasource)){
|
||||
setLastError(QObject::tr("Master datasource \"%1\" not found!!!").arg(m_masterDatasource));
|
||||
setLastError(QObject::tr("Master datasource \"%1\" not found!").arg(m_masterDatasource));
|
||||
setPrepared(false);
|
||||
} else {
|
||||
m_preparedSQL = replaceFields(replaceVariables(queryText()));
|
||||
@@ -606,11 +638,26 @@ QVariant MasterDetailProxyModel::masterData(QString fieldName) const
|
||||
|
||||
bool CallbackDatasource::next(){
|
||||
if (!m_eof){
|
||||
bool nextRowExists = checkNextRecord(m_currentRow);
|
||||
if (m_currentRow>-1){
|
||||
if (!m_getDataFromCache && nextRowExists){
|
||||
for (int i = 0; i < m_columnCount; ++i ){
|
||||
m_valuesCache[columnNameByIndex(i)] = data(columnNameByIndex(i));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if (!nextRowExists){
|
||||
m_eof = true;
|
||||
return false;
|
||||
}
|
||||
m_currentRow++;
|
||||
bool result = false;
|
||||
emit changePos(CallbackInfo::Next,result);
|
||||
bool result = true;
|
||||
if (!m_getDataFromCache)
|
||||
emit changePos(CallbackInfo::Next,result);
|
||||
m_getDataFromCache = false;
|
||||
if (m_rowCount != -1){
|
||||
if (m_rowCount>0 && m_currentRow<m_rowCount){
|
||||
if (m_rowCount > 0 && m_currentRow < m_rowCount){
|
||||
m_eof = false;
|
||||
} else {
|
||||
m_eof = true;
|
||||
@@ -623,6 +670,21 @@ bool CallbackDatasource::next(){
|
||||
} else return false;
|
||||
}
|
||||
|
||||
bool CallbackDatasource::prior(){
|
||||
if (m_currentRow !=-1) {
|
||||
if (!m_getDataFromCache && !m_valuesCache.isEmpty()){
|
||||
m_getDataFromCache = true;
|
||||
m_currentRow--;
|
||||
m_eof = false;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void CallbackDatasource::first(){
|
||||
m_currentRow = 0;
|
||||
m_eof=checkIfEmpty();
|
||||
@@ -641,12 +703,19 @@ void CallbackDatasource::first(){
|
||||
|
||||
QVariant CallbackDatasource::data(const QString& columnName)
|
||||
{
|
||||
CallbackInfo info;
|
||||
info.dataType = CallbackInfo::ColumnData;
|
||||
info.columnName = columnName;
|
||||
info.index = m_currentRow;
|
||||
QVariant result;
|
||||
emit getCallbackData(info,result);
|
||||
if (!bof())
|
||||
{
|
||||
if (!m_getDataFromCache){
|
||||
CallbackInfo info;
|
||||
info.dataType = CallbackInfo::ColumnData;
|
||||
info.columnName = columnName;
|
||||
info.index = m_currentRow;
|
||||
emit getCallbackData(info,result);
|
||||
} else {
|
||||
result = m_valuesCache[columnName];
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -672,7 +741,6 @@ int CallbackDatasource::columnCount(){
|
||||
int currIndex = 0;
|
||||
do {
|
||||
QVariant columnName;
|
||||
CallbackInfo info;
|
||||
info.dataType = CallbackInfo::ColumnHeaderData;
|
||||
info.index = currIndex;
|
||||
emit getCallbackData(info,columnName);
|
||||
@@ -697,7 +765,7 @@ QString CallbackDatasource::columnNameByIndex(int columnIndex)
|
||||
int CallbackDatasource::columnIndexByName(QString name)
|
||||
{
|
||||
for (int i=0;i<m_headers.size();++i) {
|
||||
if (m_headers[i].compare(name) == 0)
|
||||
if (m_headers[i].compare(name, Qt::CaseInsensitive) == 0)
|
||||
return i;
|
||||
}
|
||||
// if (m_headers.size()==0){
|
||||
@@ -710,8 +778,9 @@ int CallbackDatasource::columnIndexByName(QString name)
|
||||
}
|
||||
|
||||
bool CallbackDatasource::checkNextRecord(int recordNum){
|
||||
if (m_rowCount>0 && m_currentRow<m_rowCount){
|
||||
return true;
|
||||
if (bof()) checkIfEmpty();
|
||||
if (m_rowCount > 0) {
|
||||
return (m_currentRow < (m_rowCount-1));
|
||||
} else {
|
||||
QVariant result = false;
|
||||
CallbackInfo info;
|
||||
@@ -726,11 +795,18 @@ bool CallbackDatasource::checkIfEmpty(){
|
||||
if (m_rowCount == 0) {
|
||||
return true;
|
||||
} else {
|
||||
QVariant result = true;
|
||||
QVariant isEmpty = true;
|
||||
QVariant recordCount = 0;
|
||||
CallbackInfo info;
|
||||
info.dataType = CallbackInfo::RowCount;
|
||||
emit getCallbackData(info, recordCount);
|
||||
if (recordCount.toInt()>0) {
|
||||
m_rowCount = recordCount.toInt();
|
||||
return false;
|
||||
}
|
||||
info.dataType = CallbackInfo::IsEmpty;
|
||||
emit getCallbackData(info,result);
|
||||
return result.toBool();
|
||||
emit getCallbackData(info,isEmpty);
|
||||
return isEmpty.toBool();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -110,6 +110,7 @@ class ConnectionDesc : public QObject{
|
||||
Q_PROPERTY(QString password READ password WRITE setPassword)
|
||||
Q_PROPERTY(QString host READ host WRITE setHost)
|
||||
Q_PROPERTY(bool autoconnect READ autoconnect WRITE setAutoconnect)
|
||||
Q_PROPERTY(bool keepDBCredentials READ keepDBCredentials WRITE setKeepDBCredentials)
|
||||
public:
|
||||
typedef QSharedPointer<ConnectionDesc> Ptr;
|
||||
ConnectionDesc(QSqlDatabase db, QObject* parent=0);
|
||||
@@ -124,11 +125,19 @@ public:
|
||||
void setDatabaseName(const QString &value){m_databaseName=value;}
|
||||
QString databaseName(){return m_databaseName;}
|
||||
void setUserName(const QString &value){m_user=value;}
|
||||
QString userName(){return m_user;}
|
||||
QString userName(){ return m_user; }
|
||||
void setPassword(const QString &value){m_password=value;}
|
||||
QString password(){return m_password;}
|
||||
QString password(){ return m_password; }
|
||||
void setAutoconnect(bool value){m_autoconnect=value;}
|
||||
bool autoconnect(){return m_autoconnect;}
|
||||
bool isEqual(const QSqlDatabase& db);
|
||||
bool isInternal(){ return m_internal; }
|
||||
void setInternal(bool value) {m_internal = value;}
|
||||
bool keepDBCredentials() const;
|
||||
void setKeepDBCredentials(bool keepDBCredentials);
|
||||
public:
|
||||
static QString connectionNameForUser(const QString& connectionName);
|
||||
static QString connectionNameForReport(const QString& connectionName);
|
||||
signals:
|
||||
void nameChanged(const QString& oldName,const QString& newName);
|
||||
private:
|
||||
@@ -139,6 +148,8 @@ private:
|
||||
QString m_user;
|
||||
QString m_password;
|
||||
bool m_autoconnect;
|
||||
bool m_internal;
|
||||
bool m_keepDBCredentials;
|
||||
};
|
||||
|
||||
class IConnectionController{
|
||||
@@ -146,6 +157,7 @@ public:
|
||||
virtual void addConnectionDesc(ConnectionDesc* connection) = 0;
|
||||
virtual void changeConnectionDesc(ConnectionDesc* connection) = 0;
|
||||
virtual bool checkConnectionDesc(ConnectionDesc* connection) = 0;
|
||||
virtual bool containsDefaultConnection() = 0;
|
||||
virtual QString lastError() const = 0;
|
||||
};
|
||||
|
||||
@@ -368,10 +380,11 @@ private:
|
||||
class CallbackDatasource :public ICallbackDatasource, public IDataSource {
|
||||
Q_OBJECT
|
||||
public:
|
||||
CallbackDatasource(): m_currentRow(-1), m_eof(false), m_columnCount(-1), m_rowCount(-1){}
|
||||
CallbackDatasource(): m_currentRow(-1), m_eof(false), m_columnCount(-1),
|
||||
m_rowCount(-1), m_getDataFromCache(false){}
|
||||
bool next();
|
||||
bool hasNext(){ if (!m_eof) return checkNextRecord(m_currentRow); else return false;}
|
||||
bool prior(){ if (m_currentRow !=-1) {m_currentRow--; return true;} else return false;}
|
||||
bool prior();
|
||||
void first();
|
||||
void last(){}
|
||||
bool bof(){return m_currentRow == -1;}
|
||||
@@ -392,6 +405,8 @@ private:
|
||||
bool m_eof;
|
||||
int m_columnCount;
|
||||
int m_rowCount;
|
||||
QHash<QString, QVariant> m_valuesCache;
|
||||
bool m_getDataFromCache;
|
||||
};
|
||||
|
||||
class CallbackDatasourceHolder :public QObject, public IDataSourceHolder{
|
||||
|
@@ -34,6 +34,7 @@
|
||||
#include <QRegExp>
|
||||
#include <QSqlError>
|
||||
#include <QSqlQueryModel>
|
||||
#include <QFileInfo>
|
||||
#include <stdexcept>
|
||||
|
||||
namespace LimeReport{
|
||||
@@ -216,7 +217,7 @@ void DataSourceModel::updateModel()
|
||||
}
|
||||
|
||||
DataSourceManager::DataSourceManager(QObject *parent) :
|
||||
QObject(parent), m_lastError(""), m_designTime(true), m_needUpdate(false)
|
||||
QObject(parent), m_lastError(""), m_designTime(true), m_needUpdate(false), m_dbCredentialsProvider(0)
|
||||
{
|
||||
m_groupFunctionFactory.registerFunctionCreator(QLatin1String("COUNT"),new ConstructorGroupFunctionCreator<CountGroupFunction>);
|
||||
m_groupFunctionFactory.registerFunctionCreator(QLatin1String("SUM"),new ConstructorGroupFunctionCreator<SumGroupFunction>);
|
||||
@@ -227,6 +228,43 @@ DataSourceManager::DataSourceManager(QObject *parent) :
|
||||
setSystemVariable(QLatin1String("#PAGE_COUNT"),0,SecondPass);
|
||||
m_datasourcesModel.setDataSourceManager(this);
|
||||
}
|
||||
|
||||
QString DataSourceManager::defaultDatabasePath() const
|
||||
{
|
||||
return m_defaultDatabasePath;
|
||||
}
|
||||
|
||||
void DataSourceManager::setDefaultDatabasePath(const QString &defaultDatabasePath)
|
||||
{
|
||||
m_defaultDatabasePath = defaultDatabasePath;
|
||||
}
|
||||
|
||||
QString DataSourceManager::putGroupFunctionsExpressions(QString expression)
|
||||
{
|
||||
if (m_groupFunctionsExpressionsMap.contains(expression)){
|
||||
return QString::number(m_groupFunctionsExpressionsMap.value(expression));
|
||||
} else {
|
||||
m_groupFunctionsExpressions.append(expression);
|
||||
m_groupFunctionsExpressionsMap.insert(expression, m_groupFunctionsExpressions.size()-1);
|
||||
return QString::number(m_groupFunctionsExpressions.size()-1);
|
||||
}
|
||||
}
|
||||
|
||||
void DataSourceManager::clearGroupFuntionsExpressions()
|
||||
{
|
||||
m_groupFunctionsExpressionsMap.clear();
|
||||
m_groupFunctionsExpressions.clear();
|
||||
}
|
||||
|
||||
QString DataSourceManager::getExpression(QString index)
|
||||
{
|
||||
bool ok = false;
|
||||
int i = index.toInt(&ok);
|
||||
if (ok && m_groupFunctionsExpressions.size()>i)
|
||||
return m_groupFunctionsExpressions.at(index.toInt());
|
||||
else return "";
|
||||
}
|
||||
|
||||
bool DataSourceManager::designTime() const
|
||||
{
|
||||
return m_designTime;
|
||||
@@ -280,7 +318,7 @@ void DataSourceManager::removeModel(const QString &name)
|
||||
removeDatasource(name.toLower());
|
||||
}
|
||||
|
||||
ICallbackDatasource *DataSourceManager::createCallbackDatasouce(const QString& name)
|
||||
ICallbackDatasource *DataSourceManager::createCallbackDatasource(const QString& name)
|
||||
{
|
||||
ICallbackDatasource* ds = new CallbackDatasource();
|
||||
IDataSourceHolder* holder = new CallbackDatasourceHolder(dynamic_cast<IDataSource*>(ds),true);
|
||||
@@ -290,6 +328,11 @@ ICallbackDatasource *DataSourceManager::createCallbackDatasouce(const QString& n
|
||||
return ds;
|
||||
}
|
||||
|
||||
void DataSourceManager::registerDbCredentialsProvider(IDbCredentialsProvider *provider)
|
||||
{
|
||||
m_dbCredentialsProvider = provider;
|
||||
}
|
||||
|
||||
void DataSourceManager::addCallbackDatasource(ICallbackDatasource *datasource, const QString& name)
|
||||
{
|
||||
IDataSource* datasourceIntf = dynamic_cast<IDataSource*>(datasource);
|
||||
@@ -364,7 +407,8 @@ QString DataSourceManager::replaceVariables(QString value){
|
||||
QString var=rx.cap(0);
|
||||
var.remove("$V{");
|
||||
var.remove("}");
|
||||
if (variableNames().contains(var)){
|
||||
|
||||
if (variable(var).isValid()){
|
||||
value.replace(pos,rx.cap(0).length(),variable(var).toString());
|
||||
} else {
|
||||
value.replace(pos,rx.cap(0).length(),QString(tr("Variable \"%1\" not found!").arg(var)));
|
||||
@@ -532,10 +576,15 @@ int DataSourceManager::connectionIndexByName(const QString &connectionName)
|
||||
return -1;
|
||||
}
|
||||
|
||||
QList<ConnectionDesc *>& DataSourceManager::conections()
|
||||
{
|
||||
return m_connections;
|
||||
}
|
||||
|
||||
bool DataSourceManager::dataSourceIsValid(const QString &name)
|
||||
{
|
||||
if (m_datasources.value(name.toLower())) return !m_datasources.value(name.toLower())->isInvalid();
|
||||
else throw ReportError(tr("Datasource \"%1\" not found !").arg(name));
|
||||
else throw ReportError(tr("Datasource \"%1\" not found!").arg(name));
|
||||
}
|
||||
|
||||
bool DataSourceManager::isQuery(const QString &dataSourceName)
|
||||
@@ -585,16 +634,19 @@ void DataSourceManager::removeDatasource(const QString &name)
|
||||
emit datasourcesChanged();
|
||||
}
|
||||
|
||||
void DataSourceManager::removeConnection(const QString &name)
|
||||
void DataSourceManager::removeConnection(const QString &connectionName)
|
||||
{
|
||||
for(int i=0;i<m_connections.count();++i){
|
||||
if (m_connections.at(i)->name()==name){
|
||||
QSqlDatabase db = QSqlDatabase::database(name);
|
||||
db.close();
|
||||
QSqlDatabase::removeDatabase(name);
|
||||
delete m_connections.at(i);
|
||||
m_connections.removeAt(i);
|
||||
QList<ConnectionDesc*>::iterator cit = m_connections.begin();
|
||||
while( cit != m_connections.end() ){
|
||||
if ( ((*cit)->name().compare(connectionName) == 0) && (*cit)->isInternal() ){
|
||||
{
|
||||
QSqlDatabase db = QSqlDatabase::database(connectionName);
|
||||
db.close();
|
||||
}
|
||||
QSqlDatabase::removeDatabase(connectionName);
|
||||
}
|
||||
delete (*cit);
|
||||
cit = m_connections.erase(cit);
|
||||
}
|
||||
emit datasourcesChanged();
|
||||
}
|
||||
@@ -612,16 +664,21 @@ void DataSourceManager::addConnectionDesc(ConnectionDesc * connection)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw ReportError(tr("connection with name \"%1\" already exists !").arg(connection->name()));
|
||||
throw ReportError(tr("Connection with name \"%1\" already exists!").arg(connection->name()));
|
||||
}
|
||||
}
|
||||
|
||||
bool DataSourceManager::checkConnectionDesc(ConnectionDesc *connection)
|
||||
{
|
||||
if (connectConnection(connection)){
|
||||
QSqlDatabase::removeDatabase(connection->name());
|
||||
if (connection->isInternal()){
|
||||
QSqlDatabase::removeDatabase(connection->name());
|
||||
if (designTime()) emit datasourcesChanged();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (connection->isInternal())
|
||||
QSqlDatabase::removeDatabase(connection->name());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -632,7 +689,7 @@ void DataSourceManager::putHolder(const QString& name, IDataSourceHolder *dataSo
|
||||
name.toLower(),
|
||||
dataSource
|
||||
);
|
||||
} else throw ReportError(tr("datasource with name \"%1\" already exists !").arg(name));
|
||||
} else throw ReportError(tr("Datasource with name \"%1\" already exists!").arg(name));
|
||||
}
|
||||
|
||||
void DataSourceManager::putQueryDesc(QueryDesc* queryDesc)
|
||||
@@ -641,7 +698,7 @@ void DataSourceManager::putQueryDesc(QueryDesc* queryDesc)
|
||||
m_queries.append(queryDesc);
|
||||
connect(queryDesc, SIGNAL(queryTextChanged(QString,QString)),
|
||||
this, SLOT(slotQueryTextChanged(QString,QString)));
|
||||
} else throw ReportError(tr("datasource with name \"%1\" already exists !").arg(queryDesc->queryName()));
|
||||
} else throw ReportError(tr("Datasource with name \"%1\" already exists!").arg(queryDesc->queryName()));
|
||||
}
|
||||
|
||||
void DataSourceManager::putSubQueryDesc(SubQueryDesc *subQueryDesc)
|
||||
@@ -650,18 +707,72 @@ void DataSourceManager::putSubQueryDesc(SubQueryDesc *subQueryDesc)
|
||||
m_subqueries.append(subQueryDesc);
|
||||
connect(subQueryDesc, SIGNAL(queryTextChanged(QString,QString)),
|
||||
this, SLOT(slotQueryTextChanged(QString,QString)));
|
||||
} else throw ReportError(tr("datasource with name \"%1\" already exists !").arg(subQueryDesc->queryName()));
|
||||
} else throw ReportError(tr("Datasource with name \"%1\" already exists!").arg(subQueryDesc->queryName()));
|
||||
}
|
||||
|
||||
void DataSourceManager::putProxyDesc(ProxyDesc *proxyDesc)
|
||||
{
|
||||
if (!containsDatasource(proxyDesc->name())){
|
||||
m_proxies.append(proxyDesc);
|
||||
} else throw ReportError(tr("datasource with name \"%1\" already exists !").arg(proxyDesc->name()));
|
||||
} else throw ReportError(tr("Datasource with name \"%1\" already exists!").arg(proxyDesc->name()));
|
||||
}
|
||||
|
||||
bool DataSourceManager::initAndOpenDB(QSqlDatabase& db, ConnectionDesc& connectionDesc){
|
||||
|
||||
bool connected = false;
|
||||
|
||||
|
||||
db.setHostName(replaceVariables(connectionDesc.host()));
|
||||
db.setUserName(replaceVariables(connectionDesc.userName()));
|
||||
db.setPassword(replaceVariables(connectionDesc.password()));
|
||||
|
||||
if (!connectionDesc.keepDBCredentials() && m_dbCredentialsProvider){
|
||||
if (!m_dbCredentialsProvider->getUserName(connectionDesc.name()).isEmpty())
|
||||
db.setUserName(m_dbCredentialsProvider->getUserName(connectionDesc.name()));
|
||||
if (!m_dbCredentialsProvider->getPassword(connectionDesc.name()).isEmpty())
|
||||
db.setPassword(m_dbCredentialsProvider->getPassword(connectionDesc.name()));
|
||||
}
|
||||
|
||||
QString dbName = replaceVariables(connectionDesc.databaseName());
|
||||
if (connectionDesc.driver().compare("QSQLITE")==0){
|
||||
if (!defaultDatabasePath().isEmpty()){
|
||||
dbName = !QFileInfo(dbName).exists() ?
|
||||
defaultDatabasePath()+QFileInfo(dbName).fileName() :
|
||||
dbName;
|
||||
}
|
||||
if (QFileInfo(dbName).exists()){
|
||||
db.setDatabaseName(dbName);
|
||||
} else {
|
||||
setLastError(tr("Database \"%1\" not found").arg(dbName));
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
db.setDatabaseName(dbName);
|
||||
}
|
||||
|
||||
connected=db.open();
|
||||
if (!connected) setLastError(db.lastError().text());
|
||||
return connected;
|
||||
}
|
||||
|
||||
ReportSettings *DataSourceManager::reportSettings() const
|
||||
{
|
||||
return m_reportSettings;
|
||||
}
|
||||
|
||||
void DataSourceManager::setReportSettings(ReportSettings *reportSettings)
|
||||
{
|
||||
m_reportSettings = reportSettings;
|
||||
}
|
||||
|
||||
bool DataSourceManager::checkConnection(QSqlDatabase db){
|
||||
QSqlQuery query("Select 1",db);
|
||||
return query.first();
|
||||
}
|
||||
|
||||
bool DataSourceManager::connectConnection(ConnectionDesc *connectionDesc)
|
||||
{
|
||||
|
||||
bool connected = false;
|
||||
clearErrors();
|
||||
QString lastError ="";
|
||||
@@ -671,21 +782,34 @@ bool DataSourceManager::connectConnection(ConnectionDesc *connectionDesc)
|
||||
}
|
||||
|
||||
if (!QSqlDatabase::contains(connectionDesc->name())){
|
||||
QString dbError;
|
||||
{
|
||||
QSqlDatabase db = QSqlDatabase::addDatabase(connectionDesc->driver(),connectionDesc->name());
|
||||
db.setHostName(replaceVariables(connectionDesc->host()));
|
||||
db.setUserName(replaceVariables(connectionDesc->userName()));
|
||||
db.setPassword(replaceVariables(connectionDesc->password()));
|
||||
db.setDatabaseName(replaceVariables(connectionDesc->databaseName()));
|
||||
connected=db.open();
|
||||
if (!connected) lastError=db.lastError().text();
|
||||
connectionDesc->setInternal(true);
|
||||
connected=initAndOpenDB(db, *connectionDesc);
|
||||
dbError = db.lastError().text();
|
||||
}
|
||||
if (!connected){
|
||||
if (!dbError.trimmed().isEmpty())
|
||||
setLastError(dbError);
|
||||
QSqlDatabase::removeDatabase(connectionDesc->name());
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
connected = QSqlDatabase::database(connectionDesc->name()).isOpen();
|
||||
QSqlDatabase db = QSqlDatabase::database(connectionDesc->name());
|
||||
if (!connectionDesc->isEqual(db) && connectionDesc->isInternal()){
|
||||
db.close();
|
||||
connected = initAndOpenDB(db, *connectionDesc);
|
||||
} else {
|
||||
connected = checkConnection(db);
|
||||
if (!connected && connectionDesc->isInternal())
|
||||
connected = initAndOpenDB(db, *connectionDesc);
|
||||
}
|
||||
}
|
||||
|
||||
if (!connected) {
|
||||
QSqlDatabase::removeDatabase(connectionDesc->name());
|
||||
setLastError(lastError);
|
||||
if (connectionDesc->isInternal())
|
||||
QSqlDatabase::removeDatabase(connectionDesc->name());
|
||||
return false;
|
||||
} else {
|
||||
foreach(QString datasourceName, dataSourceNames()){
|
||||
@@ -736,7 +860,7 @@ QList<QString> DataSourceManager::childDatasources(const QString &parentDatasour
|
||||
foreach(QString datasourceName, dataSourceNames()){
|
||||
if (isSubQuery(datasourceName)){
|
||||
SubQueryHolder* sh = dynamic_cast<SubQueryHolder*>(dataSourceHolder(datasourceName));
|
||||
if (sh->masterDatasource().compare(parentDatasourceName,Qt::CaseInsensitive)==0){
|
||||
if (sh && sh->masterDatasource().compare(parentDatasourceName,Qt::CaseInsensitive)==0){
|
||||
result.append(datasourceName);
|
||||
}
|
||||
}
|
||||
@@ -748,7 +872,8 @@ void DataSourceManager::invalidateChildren(const QString &parentDatasourceName)
|
||||
{
|
||||
foreach(QString datasourceName, childDatasources(parentDatasourceName)){
|
||||
SubQueryHolder* sh = dynamic_cast<SubQueryHolder*>(dataSourceHolder(datasourceName));
|
||||
sh->invalidate(designTime()?IDataSource::DESIGN_MODE:IDataSource::RENDER_MODE);
|
||||
if (sh)
|
||||
sh->invalidate(designTime()?IDataSource::DESIGN_MODE:IDataSource::RENDER_MODE);
|
||||
invalidateChildren(datasourceName);
|
||||
}
|
||||
}
|
||||
@@ -775,8 +900,9 @@ bool DataSourceManager::isConnection(const QString &connectionName)
|
||||
|
||||
bool DataSourceManager::isConnectionConnected(const QString &connectionName)
|
||||
{
|
||||
if (isConnection(connectionName)){
|
||||
return QSqlDatabase::database(connectionName).isOpen();
|
||||
if (isConnection(connectionName) && QSqlDatabase::contains(connectionName)){
|
||||
QSqlDatabase db = QSqlDatabase::database(connectionName);
|
||||
return db.isValid() && QSqlDatabase::database(connectionName).isOpen();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -797,11 +923,15 @@ void DataSourceManager::disconnectConnection(const QString& connectionName)
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
QSqlDatabase db = QSqlDatabase::database(connectionName);
|
||||
if (db.isOpen()) db.close();
|
||||
|
||||
ConnectionDesc* connectionDesc = connectionByName(connectionName);
|
||||
if (connectionDesc->isInternal()){
|
||||
{
|
||||
QSqlDatabase db = QSqlDatabase::database(connectionName);
|
||||
if (db.isOpen()) db.close();
|
||||
}
|
||||
if (QSqlDatabase::contains(connectionName)) QSqlDatabase::removeDatabase(connectionName);
|
||||
}
|
||||
if (QSqlDatabase::contains(connectionName)) QSqlDatabase::removeDatabase(connectionName);
|
||||
|
||||
}
|
||||
|
||||
@@ -816,7 +946,7 @@ IDataSource *DataSourceManager::dataSource(const QString &name)
|
||||
return holder->dataSource(designTime()?IDataSource::DESIGN_MODE:IDataSource::RENDER_MODE);
|
||||
}
|
||||
} else {
|
||||
setLastError(tr("Datasource \"%1\" not found !").arg(name));
|
||||
setLastError(tr("Datasource \"%1\" not found!").arg(name));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -956,33 +1086,63 @@ QObject* DataSourceManager::elementAt(const QString &collectionName, int index)
|
||||
void DataSourceManager::collectionLoadFinished(const QString &collectionName)
|
||||
{
|
||||
|
||||
if (collectionName.compare("connections",Qt::CaseInsensitive)==0){
|
||||
if (collectionName.compare("connections",Qt::CaseInsensitive) == 0){
|
||||
|
||||
}
|
||||
|
||||
if (collectionName.compare("queries",Qt::CaseInsensitive)==0){
|
||||
foreach(QueryDesc* query,m_queries){
|
||||
connect(query, SIGNAL(queryTextChanged(QString,QString)),
|
||||
this, SLOT(slotQueryTextChanged(QString,QString)));
|
||||
putHolder(query->queryName(),new QueryHolder(query->queryText(), query->connectionName(), this));
|
||||
if (collectionName.compare("queries",Qt::CaseInsensitive) == 0){
|
||||
|
||||
QMutableListIterator<QueryDesc*> it(m_queries);
|
||||
while (it.hasNext()){
|
||||
it.next();
|
||||
if (!m_datasources.contains(it.value()->queryName().toLower())){
|
||||
connect(it.value(), SIGNAL(queryTextChanged(QString,QString)),
|
||||
this, SLOT(slotQueryTextChanged(QString,QString)));
|
||||
putHolder(it.value()->queryName(),new QueryHolder(it.value()->queryText(), it.value()->connectionName(), this));
|
||||
} else {
|
||||
delete it.value();
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (collectionName.compare("subqueries",Qt::CaseInsensitive) == 0){
|
||||
|
||||
QMutableListIterator<SubQueryDesc*> it(m_subqueries);
|
||||
while (it.hasNext()){
|
||||
it.next();
|
||||
if (!m_datasources.contains(it.value()->queryName().toLower())){
|
||||
connect(it.value(), SIGNAL(queryTextChanged(QString,QString)),
|
||||
this, SLOT(slotQueryTextChanged(QString,QString)));
|
||||
putHolder(it.value()->queryName(),new SubQueryHolder(
|
||||
it.value()->queryText(),
|
||||
it.value()->connectionName(),
|
||||
it.value()->master(),
|
||||
this)
|
||||
);
|
||||
} else {
|
||||
delete it.value();
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (collectionName.compare("subproxies",Qt::CaseInsensitive) == 0){
|
||||
QMutableListIterator<ProxyDesc*> it(m_proxies);
|
||||
while (it.hasNext()){
|
||||
it.next();
|
||||
if (!m_datasources.contains(it.value()->name().toLower())){
|
||||
putHolder(it.value()->name(),new ProxyHolder(it.value(), this));
|
||||
} else {
|
||||
delete it.value();
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (collectionName.compare("subqueries",Qt::CaseInsensitive)==0){
|
||||
foreach(SubQueryDesc* query,m_subqueries){
|
||||
connect(query, SIGNAL(queryTextChanged(QString,QString)),
|
||||
this, SLOT(slotQueryTextChanged(QString,QString)));
|
||||
putHolder(query->queryName(),new SubQueryHolder(query->queryText(), query->connectionName(), query->master(), this));
|
||||
}
|
||||
}
|
||||
|
||||
if(collectionName.compare("subproxies",Qt::CaseInsensitive)==0){
|
||||
foreach(ProxyDesc* proxy,m_proxies){
|
||||
putHolder(proxy->name(),new ProxyHolder(proxy, this));
|
||||
}
|
||||
}
|
||||
|
||||
if(collectionName.compare("variables",Qt::CaseInsensitive)==0){
|
||||
if (collectionName.compare("variables",Qt::CaseInsensitive) == 0){
|
||||
foreach (VarDesc* item, m_tempVars) {
|
||||
if (!m_reportVariables.containsVariable(item->name())){
|
||||
m_reportVariables.addVariable(item->name(),item->value(),VarDesc::Report,FirstPass);
|
||||
@@ -1098,7 +1258,8 @@ void DataSourceManager::clear(ClearMethod method)
|
||||
|
||||
QList<ConnectionDesc*>::iterator cit = m_connections.begin();
|
||||
while( cit != m_connections.end() ){
|
||||
QSqlDatabase::removeDatabase( (*cit)->name() );
|
||||
if ( (*cit)->isInternal() )
|
||||
QSqlDatabase::removeDatabase( (*cit)->name() );
|
||||
delete (*cit);
|
||||
cit = m_connections.erase(cit);
|
||||
}
|
||||
|
@@ -71,7 +71,7 @@ class DataSourceModel : public QAbstractItemModel{
|
||||
Q_OBJECT
|
||||
friend class DataSourceManager;
|
||||
public:
|
||||
DataSourceModel():m_rootNode(new DataNode()){}
|
||||
DataSourceModel():m_dataManager(NULL),m_rootNode(new DataNode()){}
|
||||
DataSourceModel(DataSourceManager* dataManager);
|
||||
~DataSourceModel();
|
||||
QModelIndex index(int row, int column, const QModelIndex &parent) const;
|
||||
@@ -114,7 +114,8 @@ public:
|
||||
void addProxy(const QString& name, QString master, QString detail, QList<FieldsCorrelation> fields);
|
||||
bool addModel(const QString& name, QAbstractItemModel *model, bool owned);
|
||||
void removeModel(const QString& name);
|
||||
ICallbackDatasource* createCallbackDatasouce(const QString &name);
|
||||
ICallbackDatasource* createCallbackDatasource(const QString &name);
|
||||
void registerDbCredentialsProvider(IDbCredentialsProvider *provider);
|
||||
void addCallbackDatasource(ICallbackDatasource *datasource, const QString &name);
|
||||
void setReportVariable(const QString& name, const QVariant& value);
|
||||
void deleteVariable(const QString& name);
|
||||
@@ -131,7 +132,7 @@ public:
|
||||
QString queryText(const QString& dataSourceName);
|
||||
QString connectionName(const QString& dataSourceName);
|
||||
void removeDatasource(const QString& name);
|
||||
void removeConnection(const QString& name);
|
||||
void removeConnection(const QString& connectionName);
|
||||
bool isQuery(const QString& dataSourceName);
|
||||
bool containsDatasource(const QString& dataSourceName);
|
||||
bool isSubQuery(const QString& dataSourceName);
|
||||
@@ -150,6 +151,7 @@ public:
|
||||
int proxyIndexByName(const QString& dataSourceName);
|
||||
int connectionIndexByName(const QString& connectionName);
|
||||
|
||||
QList<ConnectionDesc *> &conections();
|
||||
bool dataSourceIsValid(const QString& name);
|
||||
IDataSource* dataSource(const QString& name);
|
||||
IDataSourceHolder* dataSourceHolder(const QString& name);
|
||||
@@ -189,6 +191,16 @@ public:
|
||||
QSharedPointer<QAbstractItemModel> previewSQL(const QString& connectionName, const QString& sqlText, QString masterDatasource="");
|
||||
void updateDatasourceModel();
|
||||
bool isNeedUpdateDatasourceModel(){ return m_needUpdate;}
|
||||
QString defaultDatabasePath() const;
|
||||
void setDefaultDatabasePath(const QString &defaultDatabasePath);
|
||||
|
||||
QString putGroupFunctionsExpressions(QString expression);
|
||||
void clearGroupFuntionsExpressions();
|
||||
QString getExpression(QString index);
|
||||
|
||||
ReportSettings *reportSettings() const;
|
||||
void setReportSettings(ReportSettings *reportSettings);
|
||||
|
||||
signals:
|
||||
void loadCollectionFinished(const QString& collectionName);
|
||||
void cleared();
|
||||
@@ -208,16 +220,16 @@ protected:
|
||||
virtual QObject *elementAt(const QString& collectionName,int index);
|
||||
virtual void collectionLoadFinished(const QString& collectionName);
|
||||
|
||||
|
||||
void setSystemVariable(const QString& name, const QVariant& value, RenderPass pass);
|
||||
void setLastError(const QString& value);
|
||||
void invalidateLinkedDatasources(QString datasourceName);
|
||||
|
||||
bool checkConnection(QSqlDatabase db);
|
||||
private slots:
|
||||
void slotConnectionRenamed(const QString& oldName,const QString& newName);
|
||||
void slotQueryTextChanged(const QString& queryName, const QString& queryText);
|
||||
private:
|
||||
explicit DataSourceManager(QObject *parent = 0);
|
||||
bool initAndOpenDB(QSqlDatabase &db, ConnectionDesc &connectionDesc);
|
||||
Q_DISABLE_COPY(DataSourceManager)
|
||||
private:
|
||||
QList<ConnectionDesc*> m_connections;
|
||||
@@ -236,7 +248,13 @@ private:
|
||||
QStringList m_errorsList;
|
||||
bool m_designTime;
|
||||
bool m_needUpdate;
|
||||
QString m_defaultDatabasePath;
|
||||
ReportSettings* m_reportSettings;
|
||||
QHash<QString,int> m_groupFunctionsExpressionsMap;
|
||||
QVector<QString> m_groupFunctionsExpressions;
|
||||
IDbCredentialsProvider* m_dbCredentialsProvider;
|
||||
};
|
||||
|
||||
}
|
||||
#endif // LRDATASOURCEMANAGER_H
|
||||
|
||||
|
@@ -37,17 +37,25 @@ class QString;
|
||||
class QAbstractItemModel;
|
||||
namespace LimeReport{
|
||||
|
||||
class IDbCredentialsProvider{
|
||||
public:
|
||||
virtual QString getUserName(const QString& connectionName) = 0;
|
||||
virtual QString getPassword(const QString& connectionName) = 0;
|
||||
};
|
||||
|
||||
class IDataSourceManager{
|
||||
public:
|
||||
virtual void setReportVariable(const QString& name, const QVariant& value)=0;
|
||||
virtual void deleteVariable(const QString& name)=0;
|
||||
virtual bool containsVariable(const QString& variableName)=0;
|
||||
virtual QVariant variable(const QString& variableName)=0;
|
||||
virtual bool addModel(const QString& name, QAbstractItemModel *model, bool owned)=0;
|
||||
virtual void removeModel(const QString& name)=0;
|
||||
virtual bool containsDatasource(const QString& dataSourceName)=0;
|
||||
virtual void setReportVariable(const QString& name, const QVariant& value) = 0;
|
||||
virtual void setDefaultDatabasePath(const QString &defaultDatabasePath) = 0;
|
||||
virtual void deleteVariable(const QString& name) = 0;
|
||||
virtual bool containsVariable(const QString& variableName) = 0;
|
||||
virtual QVariant variable(const QString& variableName) = 0;
|
||||
virtual bool addModel(const QString& name, QAbstractItemModel *model, bool owned) = 0;
|
||||
virtual void removeModel(const QString& name) = 0;
|
||||
virtual bool containsDatasource(const QString& dataSourceName) = 0;
|
||||
virtual void clearUserVariables()=0;
|
||||
virtual ICallbackDatasource* createCallbackDatasouce(const QString& name) = 0;
|
||||
virtual ICallbackDatasource* createCallbackDatasource(const QString& name) = 0;
|
||||
virtual void registerDbCredentialsProvider(IDbCredentialsProvider* provider) = 0;
|
||||
//virtual void addCallbackDatasource(ICallbackDatasource* datasource, const QString& name) = 0;
|
||||
};
|
||||
|
||||
|
430
limereport/lrfactoryinitializer.cpp
Normal file
@@ -0,0 +1,430 @@
|
||||
#include "bands/lrdataband.h"
|
||||
#include "bands/lrgroupbands.h"
|
||||
#include "bands/lrpagefooter.h"
|
||||
#include "bands/lrpageheader.h"
|
||||
#include "bands/lrreportheader.h"
|
||||
#include "bands/lrreportfooter.h"
|
||||
#include "bands/lrsubdetailband.h"
|
||||
#include "bands/lrtearoffband.h"
|
||||
|
||||
|
||||
#include "items/lrtextitem.h"
|
||||
#ifdef HAVE_ZINT
|
||||
#include "items/lrbarcodeitem.h"
|
||||
#endif
|
||||
#include "items/lrhorizontallayout.h"
|
||||
#include "items/lrimageitem.h"
|
||||
#include "items/lrshapeitem.h"
|
||||
#include "lrdesignelementsfactory.h"
|
||||
|
||||
|
||||
#include "objectinspector/lrobjectpropitem.h"
|
||||
#include "objectinspector/propertyItems/lrboolpropitem.h"
|
||||
#include "objectinspector/propertyItems/lrcolorpropitem.h"
|
||||
#include "objectinspector/propertyItems/lrcontentpropitem.h"
|
||||
#include "objectinspector/propertyItems/lrdatasourcepropitem.h"
|
||||
#include "objectinspector/propertyItems/lrenumpropitem.h"
|
||||
#include "objectinspector/propertyItems/lrflagspropitem.h"
|
||||
#include "objectinspector/propertyItems/lrfontpropitem.h"
|
||||
#include "objectinspector/propertyItems/lrgroupfieldpropitem.h"
|
||||
#include "objectinspector/propertyItems/lrimagepropitem.h"
|
||||
#include "objectinspector/propertyItems/lrintpropitem.h"
|
||||
#include "objectinspector/propertyItems/lrqrealpropitem.h"
|
||||
#include "objectinspector/propertyItems/lrrectproptem.h"
|
||||
#include "objectinspector/propertyItems/lrstringpropitem.h"
|
||||
#include "items/lralignpropitem.h"
|
||||
#include "items/lrsubitemparentpropitem.h"
|
||||
|
||||
#include "serializators/lrxmlbasetypesserializators.h"
|
||||
#include "serializators/lrxmlqrectserializator.h"
|
||||
#include "serializators/lrxmlserializatorsfactory.h"
|
||||
|
||||
void initResources(){
|
||||
Q_INIT_RESOURCE(report);
|
||||
Q_INIT_RESOURCE(lobjectinspector);
|
||||
Q_INIT_RESOURCE(lrdatabrowser);
|
||||
Q_INIT_RESOURCE(items);
|
||||
Q_INIT_RESOURCE(lrscriptbrowser);
|
||||
}
|
||||
|
||||
namespace LimeReport{
|
||||
|
||||
BaseDesignIntf * createDataBand(QObject* owner, LimeReport::BaseDesignIntf* parent){
|
||||
return new LimeReport::DataBand(owner,parent);
|
||||
}
|
||||
BaseDesignIntf * createHeaderDataBand(QObject* owner, LimeReport::BaseDesignIntf* parent){
|
||||
return new LimeReport::DataHeaderBand(owner,parent);
|
||||
}
|
||||
BaseDesignIntf * createFooterDataBand(QObject* owner, LimeReport::BaseDesignIntf* parent){
|
||||
return new LimeReport::DataFooterBand(owner,parent);
|
||||
}
|
||||
|
||||
BaseDesignIntf* createGroupHeaderBand(QObject* owner, LimeReport::BaseDesignIntf* parent){
|
||||
return new LimeReport::GroupBandHeader(owner,parent);
|
||||
}
|
||||
|
||||
BaseDesignIntf * createGroupFooterBand(QObject* owner, LimeReport::BaseDesignIntf* parent){
|
||||
return new LimeReport::GroupBandFooter(owner,parent);
|
||||
}
|
||||
|
||||
BaseDesignIntf * createPageHeaderBand(QObject* owner, LimeReport::BaseDesignIntf* parent){
|
||||
return new LimeReport::PageHeader(owner,parent);
|
||||
}
|
||||
|
||||
BaseDesignIntf * createPageFooterBand(QObject* owner, LimeReport::BaseDesignIntf* parent){
|
||||
return new LimeReport::PageFooter(owner,parent);
|
||||
}
|
||||
|
||||
BaseDesignIntf * createSubDetailBand(QObject* owner, LimeReport::BaseDesignIntf* parent){
|
||||
return new LimeReport::SubDetailBand(owner,parent);
|
||||
}
|
||||
|
||||
BaseDesignIntf * createSubDetailHeaderBand(QObject* owner, LimeReport::BaseDesignIntf* parent){
|
||||
return new LimeReport::SubDetailHeaderBand(owner,parent);
|
||||
}
|
||||
|
||||
BaseDesignIntf * createSubDetailFooterBand(QObject* owner, LimeReport::BaseDesignIntf* parent){
|
||||
return new LimeReport::SubDetailFooterBand(owner,parent);
|
||||
}
|
||||
|
||||
BaseDesignIntf * createTearOffBand(QObject* owner, LimeReport::BaseDesignIntf* parent){
|
||||
return new LimeReport::TearOffBand(owner,parent);
|
||||
}
|
||||
|
||||
BaseDesignIntf * createTextItem(QObject* owner, LimeReport::BaseDesignIntf* parent){
|
||||
return new LimeReport::TextItem(owner,parent);
|
||||
}
|
||||
|
||||
#ifdef HAVE_ZINT
|
||||
BaseDesignIntf * createBarcodeItem(QObject* owner, LimeReport::BaseDesignIntf* parent){
|
||||
return new BarcodeItem(owner,parent);
|
||||
}
|
||||
#endif
|
||||
|
||||
BaseDesignIntf* createHLayout(QObject *owner, LimeReport::BaseDesignIntf *parent)
|
||||
{
|
||||
return new HorizontalLayout(owner, parent);
|
||||
}
|
||||
|
||||
BaseDesignIntf * createImageItem(QObject* owner, LimeReport::BaseDesignIntf* parent){
|
||||
return new ImageItem(owner,parent);
|
||||
}
|
||||
|
||||
BaseDesignIntf * createShapeItem(QObject* owner, LimeReport::BaseDesignIntf* parent){
|
||||
return new ShapeItem(owner,parent);
|
||||
}
|
||||
|
||||
void initReportItems(){
|
||||
initResources();
|
||||
DesignElementsFactory::instance().registerCreator(
|
||||
"TextItem",
|
||||
LimeReport::ItemAttribs(QObject::tr("Text Item"),"TextItem"),
|
||||
createTextItem
|
||||
);
|
||||
#ifdef HAVE_ZINT
|
||||
DesignElementsFactory::instance().registerCreator(
|
||||
"BarcodeItem",
|
||||
LimeReport::ItemAttribs(QObject::tr("Barcode Item"),"Item"),
|
||||
createBarcodeItem
|
||||
);
|
||||
#endif
|
||||
DesignElementsFactory::instance().registerCreator(
|
||||
"HLayout",
|
||||
LimeReport::ItemAttribs(QObject::tr("HLayout"), LimeReport::Const::bandTAG),
|
||||
createHLayout
|
||||
);
|
||||
DesignElementsFactory::instance().registerCreator(
|
||||
"ImageItem", LimeReport::ItemAttribs(QObject::tr("Image Item"),"Item"), createImageItem
|
||||
);
|
||||
DesignElementsFactory::instance().registerCreator(
|
||||
"ShapeItem", LimeReport::ItemAttribs(QObject::tr("Shape Item"),"Item"), createShapeItem
|
||||
);
|
||||
DesignElementsFactory::instance().registerCreator(
|
||||
"Data",
|
||||
LimeReport::ItemAttribs(QObject::tr("Data"),LimeReport::Const::bandTAG),
|
||||
createDataBand
|
||||
);
|
||||
DesignElementsFactory::instance().registerCreator(
|
||||
"DataHeader",
|
||||
LimeReport::ItemAttribs(QObject::tr("DataHeader"),LimeReport::Const::bandTAG),
|
||||
createHeaderDataBand
|
||||
);
|
||||
DesignElementsFactory::instance().registerCreator(
|
||||
"DataFooter",
|
||||
LimeReport::ItemAttribs(QObject::tr("DataFooter"),LimeReport::Const::bandTAG),
|
||||
createFooterDataBand
|
||||
);
|
||||
DesignElementsFactory::instance().registerCreator(
|
||||
"GroupHeader",
|
||||
LimeReport::ItemAttribs(QObject::tr("GroupHeader"),LimeReport::Const::bandTAG),
|
||||
createGroupHeaderBand
|
||||
);
|
||||
DesignElementsFactory::instance().registerCreator(
|
||||
"GroupFooter",
|
||||
LimeReport::ItemAttribs(QObject::tr("GroupFooter"),LimeReport::Const::bandTAG),
|
||||
createGroupFooterBand
|
||||
);
|
||||
DesignElementsFactory::instance().registerCreator(
|
||||
"PageFooter",
|
||||
LimeReport::ItemAttribs(QObject::tr("Page Footer"),LimeReport::Const::bandTAG),
|
||||
createPageFooterBand
|
||||
);
|
||||
DesignElementsFactory::instance().registerCreator(
|
||||
"PageHeader",
|
||||
LimeReport::ItemAttribs(QObject::tr("Page Header"),LimeReport::Const::bandTAG),
|
||||
createPageHeaderBand
|
||||
);
|
||||
DesignElementsFactory::instance().registerCreator(
|
||||
"SubDetail",
|
||||
LimeReport::ItemAttribs(QObject::tr("SubDetail"),LimeReport::Const::bandTAG),
|
||||
createSubDetailBand
|
||||
);
|
||||
|
||||
DesignElementsFactory::instance().registerCreator(
|
||||
"SubDetailHeader",
|
||||
LimeReport::ItemAttribs(QObject::tr("SubDetailHeader"),LimeReport::Const::bandTAG),
|
||||
createSubDetailHeaderBand
|
||||
);
|
||||
DesignElementsFactory::instance().registerCreator(
|
||||
"SubDetailFooter",
|
||||
LimeReport::ItemAttribs(QObject::tr("SubDetailFooter"),LimeReport::Const::bandTAG),
|
||||
createSubDetailFooterBand
|
||||
);
|
||||
DesignElementsFactory::instance().registerCreator(
|
||||
"TearOffBand",
|
||||
LimeReport::ItemAttribs(QObject::tr("Tear-off Band"),LimeReport::Const::bandTAG),
|
||||
createTearOffBand
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
ObjectPropItem * createBoolPropItem(
|
||||
QObject *object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly)
|
||||
{
|
||||
return new LimeReport::BoolPropItem(object, objects, name, displayName, data, parent, readonly);
|
||||
}
|
||||
|
||||
ObjectPropItem * createColorPropItem(
|
||||
QObject *object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly)
|
||||
{
|
||||
return new ColorPropItem(object, objects, name, displayName, data, parent, readonly);
|
||||
}
|
||||
|
||||
ObjectPropItem * createContentPropItem(
|
||||
QObject *object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly)
|
||||
{
|
||||
return new ContentPropItem(object, objects, name, displayName, data, parent, readonly);
|
||||
}
|
||||
|
||||
ObjectPropItem * createDatasourcePropItem(
|
||||
QObject *object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly)
|
||||
{
|
||||
return new LimeReport::DatasourcePropItem(object, objects, name, displayName, data, parent, readonly);
|
||||
}
|
||||
|
||||
ObjectPropItem* createFieldPropItem(QObject *object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly){
|
||||
return new LimeReport::FieldPropItem(object, objects, name, displayName, data, parent, readonly);
|
||||
}
|
||||
|
||||
ObjectPropItem * createEnumPropItem(
|
||||
QObject *object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly)
|
||||
{
|
||||
return new LimeReport::EnumPropItem(object, objects, name, displayName, data, parent, readonly);
|
||||
}
|
||||
|
||||
ObjectPropItem * createFlagsPropItem(
|
||||
QObject *object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly)
|
||||
{
|
||||
return new LimeReport::FlagsPropItem(object, objects, name, displayName, data, parent, readonly);
|
||||
}
|
||||
|
||||
ObjectPropItem * createFontPropItem(
|
||||
QObject *object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly)
|
||||
{
|
||||
return new LimeReport::FontPropItem(object, objects, name, displayName, data, parent, readonly);
|
||||
}
|
||||
|
||||
ObjectPropItem* createGroupFieldPropItem(QObject *object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly){
|
||||
return new LimeReport::GroupFieldPropItem(object, objects, name, displayName, data, parent, readonly);
|
||||
}
|
||||
|
||||
ObjectPropItem * createImagePropItem(
|
||||
QObject *object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly)
|
||||
{
|
||||
return new LimeReport::ImagePropItem(object, objects, name, displayName, data, parent, readonly);
|
||||
}
|
||||
|
||||
ObjectPropItem * createIntPropItem(
|
||||
QObject *object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly)
|
||||
{
|
||||
return new LimeReport::IntPropItem(object, objects, name, displayName, data, parent, readonly);
|
||||
}
|
||||
|
||||
ObjectPropItem * createQRealPropItem(
|
||||
QObject *object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly)
|
||||
{
|
||||
return new LimeReport::QRealPropItem(object, objects, name, displayName, data, parent, readonly);
|
||||
}
|
||||
|
||||
ObjectPropItem * createReqtItem(
|
||||
QObject *object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly
|
||||
){
|
||||
return new LimeReport::RectPropItem(object, objects, name, displayName, data, parent, readonly);
|
||||
}
|
||||
|
||||
ObjectPropItem * createReqtMMItem(
|
||||
QObject*object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly
|
||||
){
|
||||
return new LimeReport::RectMMPropItem(object, objects, name, displayName, data, parent, readonly);
|
||||
}
|
||||
|
||||
ObjectPropItem * createStringPropItem(
|
||||
QObject *object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly)
|
||||
{
|
||||
return new LimeReport::StringPropItem(object, objects, name, displayName, data, parent, readonly);
|
||||
}
|
||||
|
||||
ObjectPropItem * createAlignItem(
|
||||
QObject *object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly
|
||||
){
|
||||
return new LimeReport::AlignmentPropItem(object, objects, name, displayName, data, parent, readonly);
|
||||
}
|
||||
|
||||
ObjectPropItem * createLocationPropItem(
|
||||
QObject *object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly)
|
||||
{
|
||||
return new LimeReport::ItemLocationPropItem(object, objects, name, displayName, data, parent, readonly);
|
||||
}
|
||||
|
||||
void initObjectInspectorProperties()
|
||||
{
|
||||
ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("bool",""),QObject::tr("bool"),createBoolPropItem
|
||||
);
|
||||
ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("QColor",""),QObject::tr("QColor"),createColorPropItem
|
||||
);
|
||||
ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("content","LimeReport::TextItem"),QObject::tr("content"),createContentPropItem
|
||||
);
|
||||
ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("datasource","LimeReport::DataBandDesignIntf"),QObject::tr("datasource"),createDatasourcePropItem
|
||||
);
|
||||
ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("datasource","LimeReport::ImageItem"),QObject::tr("datasource"),createDatasourcePropItem
|
||||
);
|
||||
ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("field","LimeReport::ImageItem"),QObject::tr("field"),createFieldPropItem
|
||||
);
|
||||
ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("enum",""),QObject::tr("enum"),createEnumPropItem
|
||||
);
|
||||
ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("flags",""),QObject::tr("flags"),createFlagsPropItem
|
||||
);
|
||||
ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("QFont",""),QObject::tr("QFont"),createFontPropItem
|
||||
);
|
||||
ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("groupFieldName","LimeReport::GroupBandHeader"),QObject::tr("field"),createGroupFieldPropItem
|
||||
);
|
||||
ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("QImage",""),QObject::tr("QImage"),createImagePropItem
|
||||
);
|
||||
ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("int",""),QObject::tr("int"),createIntPropItem
|
||||
);
|
||||
ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("qreal",""),QObject::tr("qreal"),createQRealPropItem
|
||||
);
|
||||
ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("double",""),QObject::tr("qreal"),createQRealPropItem
|
||||
);
|
||||
ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("QRect",""),QObject::tr("QRect"),createReqtItem
|
||||
);
|
||||
ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("QRectF",""),QObject::tr("QRectF"),createReqtItem
|
||||
);
|
||||
ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("geometry","LimeReport::BaseDesignIntf"),QObject::tr("geometry"),createReqtMMItem
|
||||
);
|
||||
ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("QString",""),QObject::tr("QString"),createStringPropItem
|
||||
);
|
||||
ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("alignment","LimeReport::TextItem"),QObject::tr("alignment"),createAlignItem
|
||||
);
|
||||
ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("itemLocation","LimeReport::ItemDesignIntf"),QObject::tr("itemLocation"),createLocationPropItem
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
SerializatorIntf * createIntSerializator(QDomDocument *doc, QDomElement *node){
|
||||
return new LimeReport::XmlIntSerializator(doc,node);
|
||||
}
|
||||
|
||||
SerializatorIntf * createQRealSerializator(QDomDocument *doc, QDomElement *node){
|
||||
return new LimeReport::XmlQRealSerializator(doc,node);
|
||||
}
|
||||
|
||||
SerializatorIntf * createQStringSerializator(QDomDocument *doc, QDomElement *node){
|
||||
return new LimeReport::XmlQStringSerializator(doc,node);
|
||||
}
|
||||
|
||||
SerializatorIntf * createEnumAndFlagsSerializator(QDomDocument *doc, QDomElement *node){
|
||||
return new LimeReport::XmlEnumAndFlagsSerializator(doc,node);
|
||||
}
|
||||
|
||||
SerializatorIntf * createBoolSerializator(QDomDocument *doc, QDomElement *node){
|
||||
return new LimeReport::XmlBoolSerializator(doc,node);
|
||||
}
|
||||
|
||||
SerializatorIntf * createFontSerializator(QDomDocument *doc, QDomElement *node){
|
||||
return new LimeReport::XmlFontSerializator(doc,node);
|
||||
}
|
||||
|
||||
SerializatorIntf * createQSizeFSerializator(QDomDocument *doc, QDomElement *node){
|
||||
return new LimeReport::XmlQSizeFSerializator(doc,node);
|
||||
}
|
||||
|
||||
SerializatorIntf * createQImageSerializator(QDomDocument *doc, QDomElement *node){
|
||||
return new LimeReport::XmlQImageSerializator(doc,node);
|
||||
}
|
||||
|
||||
SerializatorIntf * createQColorSerializator(QDomDocument *doc, QDomElement *node){
|
||||
return new LimeReport::XmlColorSerializator(doc,node);
|
||||
}
|
||||
|
||||
SerializatorIntf* createQByteArraySerializator(QDomDocument *doc, QDomElement *node){
|
||||
return new LimeReport::XmlQByteArraySerializator(doc,node);
|
||||
}
|
||||
|
||||
SerializatorIntf* createQVariantSerializator(QDomDocument *doc, QDomElement *node){
|
||||
return new LimeReport::XmlQVariantSerializator(doc,node);
|
||||
}
|
||||
|
||||
SerializatorIntf * createQRectSerializator(QDomDocument *doc, QDomElement *node){
|
||||
return new LimeReport::XMLQRectSerializator(doc,node);
|
||||
}
|
||||
|
||||
void initSerializators()
|
||||
{
|
||||
XMLAbstractSerializatorFactory::instance().registerCreator("QString", createQStringSerializator);
|
||||
XMLAbstractSerializatorFactory::instance().registerCreator("int", createIntSerializator);
|
||||
XMLAbstractSerializatorFactory::instance().registerCreator("enumAndFlags",createEnumAndFlagsSerializator);
|
||||
XMLAbstractSerializatorFactory::instance().registerCreator("bool", createBoolSerializator);
|
||||
XMLAbstractSerializatorFactory::instance().registerCreator("QFont", createFontSerializator);
|
||||
XMLAbstractSerializatorFactory::instance().registerCreator("QSizeF", createQSizeFSerializator);
|
||||
XMLAbstractSerializatorFactory::instance().registerCreator("QImage", createQImageSerializator);
|
||||
XMLAbstractSerializatorFactory::instance().registerCreator("qreal", createQRealSerializator);
|
||||
XMLAbstractSerializatorFactory::instance().registerCreator("double", createQRealSerializator);
|
||||
XMLAbstractSerializatorFactory::instance().registerCreator("QColor", createQColorSerializator);
|
||||
XMLAbstractSerializatorFactory::instance().registerCreator("QByteArray", createQByteArraySerializator);
|
||||
XMLAbstractSerializatorFactory::instance().registerCreator("QVariant", createQVariantSerializator);
|
||||
XMLAbstractSerializatorFactory::instance().registerCreator("QRect", createQRectSerializator);
|
||||
XMLAbstractSerializatorFactory::instance().registerCreator("QRectF", createQRectSerializator);
|
||||
}
|
||||
|
||||
} //namespace LimeReport
|
6
limereport/lrfactoryinitializer.h
Normal file
@@ -0,0 +1,6 @@
|
||||
void initResources();
|
||||
namespace LimeReport{
|
||||
void initReportItems();
|
||||
void initObjectInspectorProperties();
|
||||
void initSerializators();
|
||||
} // namespace LimeReport
|
@@ -51,4 +51,29 @@ void ReportSettings::setSuppressAbsentFieldsAndVarsWarnings(bool suppressAbsentF
|
||||
m_suppressAbsentFieldsAndVarsWarnings = suppressAbsentFieldsAndVarsWarnings;
|
||||
}
|
||||
|
||||
QString escapeSimbols(const QString &value)
|
||||
{
|
||||
QString result = value;
|
||||
result.replace("\"","\\\"");
|
||||
result.replace('\n',"\\n");
|
||||
return result;
|
||||
}
|
||||
|
||||
QString replaceHTMLSymbols(const QString &value)
|
||||
{
|
||||
QString result = value;
|
||||
result.replace("<","<");
|
||||
result.replace(">",">");
|
||||
return result;
|
||||
}
|
||||
|
||||
QVector<QString> normalizeCaptures(const QRegExp& reg){
|
||||
QVector<QString> result;
|
||||
foreach (QString cap, reg.capturedTexts()) {
|
||||
if (!cap.isEmpty())
|
||||
result.append(cap);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
} //namespace LimeReport
|
||||
|
@@ -42,6 +42,13 @@
|
||||
# define LIMEREPORT_EXPORT /**/
|
||||
#endif
|
||||
|
||||
#ifdef USE_QJSENGINE
|
||||
//#include <QJSEngine>
|
||||
#include <QQmlEngine>
|
||||
#else
|
||||
#include <QScriptEngine>
|
||||
#endif
|
||||
|
||||
namespace LimeReport {
|
||||
|
||||
#ifdef __GNUC__
|
||||
@@ -77,14 +84,30 @@ namespace Const{
|
||||
const QString FIELD_RX = "\\$D\\s*\\{\\s*([^{}]*)\\s*\\}";
|
||||
const QString VARIABLE_RX = "\\$V\\s*\\{\\s*([^{}]*)\\s*\\}";
|
||||
const QString SCRIPT_RX = "\\$S\\s*\\{(.*)\\}";
|
||||
const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*(((?:\\\"?\\$D\\s*\\{\\s*)|(?:\\\"?\\$V\\s*\\{\\s*)|(?:\\\"))(\\w+\\.?\\w+)((?:\\\")|(?:\\s*\\}\\\"?\\s*)))\\s*,\\s*\\\"(\\w+)\\\"\\s*\\)";
|
||||
const int DATASOURCE_INDEX = 6;
|
||||
const int VALUE_INDEX = 2;
|
||||
|
||||
//const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*(((?:\\\"?\\$D\\s*\\{\\s*)|(?:\\\"?\\$V\\s*\\{\\s*)|(?:\\\"))(\\w+\\.?\\w+)((?:\\\")|(?:\\s*\\}\\\"?\\s*)))\\s*,\\s*\\\"(\\w+)\\\"\\s*\\)";
|
||||
//const int DATASOURCE_INDEX = 6;
|
||||
//const int VALUE_INDEX = 2;
|
||||
|
||||
//const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*(?:(?:((?:(?:\\\"?\\$D\\s*\\{\\s*)|(?:\\\"?\\$V\\s*\\{\\s*)|(?:\\\"?\\$S\\s*\\{\\s*)|(?:\\\"))((?:\\w+\\.?\\w+)|(?:\\w+))(?:(?:\\\")|(?:\\s*\\}\\\"?\\s*)))\\s*,)|(?:))\\s*\\\"(\\w+)\\\"\\s*\\)";
|
||||
//const QString GROUP_FUNCTION_PARAM_RX = "\\((?:(.+),(.+))|(?:\\\"(\\w+)\\\")\\)";
|
||||
//const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*(?:(?:(?:(?:\\\")|(?:))(\\w+)(?:(?:\\\")|(?:)))|(?:(?:(?:\\\")|(?:))(\\s*\\$\\w\\s*\\{.+\\}\\s*)(?:(?:\\\")|(?:))\\s*,\\s*(?:(?:\\\")|(?:))(\\w+)(?:(?:\\\")|(?:))))\\)";
|
||||
const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*((?:(?:\\\")|(?:))(?:(?:\\$(?:(?:D\\{\\s*\\w*.\\w*\\s*\\})|(?:V\\{\\s*\\w*\\s*\\})|(?:S\\{.+\\})))|(?:\\w*))(?:(?:\\\")|(?:)))(?:(?:\\s*,\\s*(?:\\\"(\\w*)\\\"))|(?:))\\)";
|
||||
const int DATASOURCE_INDEX = 3;//4;
|
||||
const int VALUE_INDEX = 2; //2;
|
||||
const int EXPRESSION_ARGUMENT_INDEX = 1;//3;
|
||||
|
||||
const QString GROUP_FUNCTION_RX = "(%1\\s*"+GROUP_FUNCTION_PARAM_RX+")";
|
||||
const QString GROUP_FUNCTION_NAME_RX = "%1\\s*\\((.*[^\\)])\\)";
|
||||
const int SCENE_MARGIN = 50;
|
||||
const QString FUNCTION_MANAGER_NAME = "LimeReport";
|
||||
}
|
||||
QString extractClassName(QString className);
|
||||
QString escapeSimbols(const QString& value);
|
||||
QString replaceHTMLSymbols(const QString &value);
|
||||
QVector<QString> normalizeCaptures(const QRegExp ®);
|
||||
|
||||
enum ExpandType {EscapeSymbols, NoEscapeSymbols, ReplaceHTMLSymbols};
|
||||
enum RenderPass {FirstPass, SecondPass};
|
||||
enum ArrangeType {AsNeeded, Force};
|
||||
enum PreviewHint{ShowAllPreviewBars = 0,
|
||||
@@ -93,6 +116,7 @@ namespace Const{
|
||||
HidePreviewStatusBar = 4,
|
||||
HideAllPreviewBar = 7,
|
||||
PreviewBarsUserSetting = 8};
|
||||
|
||||
Q_DECLARE_FLAGS(PreviewHints, PreviewHint)
|
||||
Q_FLAGS(PreviewHints)
|
||||
|
||||
@@ -117,6 +141,20 @@ namespace Const{
|
||||
typedef QStyleOptionViewItem StyleOptionViewItem;
|
||||
#endif
|
||||
|
||||
#ifdef USE_QJSENGINE
|
||||
typedef QQmlEngine ScriptEngineType;
|
||||
typedef QJSValue ScriptValueType;
|
||||
template <typename T>
|
||||
static inline QJSValue getCppOwnedJSValue(QJSEngine &e, T *p)
|
||||
{
|
||||
QJSValue res = e.newQObject(p);
|
||||
QQmlEngine::setObjectOwnership(p, QQmlEngine::CppOwnership);
|
||||
return res;
|
||||
}
|
||||
#else
|
||||
typedef QScriptEngine ScriptEngineType;
|
||||
typedef QScriptValue ScriptValueType;
|
||||
#endif
|
||||
|
||||
} // namespace LimeReport
|
||||
|
||||
|
@@ -31,6 +31,7 @@
|
||||
#include "lrdatasourcemanager.h"
|
||||
#include "lrbanddesignintf.h"
|
||||
#include "lritemdesignintf.h"
|
||||
#include "lrscriptenginemanager.h"
|
||||
|
||||
#include <QRegExp>
|
||||
|
||||
@@ -38,26 +39,51 @@ namespace LimeReport {
|
||||
|
||||
void GroupFunction::slotBandRendered(BandDesignIntf *band)
|
||||
{
|
||||
ScriptEngineManager& sm = ScriptEngineManager::instance();
|
||||
|
||||
QRegExp rxField(Const::FIELD_RX);
|
||||
QRegExp rxVar(Const::VARIABLE_RX);
|
||||
|
||||
switch (m_dataType){
|
||||
case Field:
|
||||
if (m_dataManager->containsField(m_data)){
|
||||
m_values.push_back(m_dataManager->fieldData(m_data));
|
||||
} else {
|
||||
setInvalid(tr("Field \"%1\" not found").arg(m_data));
|
||||
if (rxField.indexIn(m_data) != -1){
|
||||
QString field = rxField.cap(1);
|
||||
if (m_dataManager->containsField(field)){
|
||||
m_values.push_back(m_dataManager->fieldData(field));
|
||||
} else {
|
||||
setInvalid(tr("Field \"%1\" not found").arg(m_data));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Variable:
|
||||
if (m_dataManager->containsVariable(m_data)){
|
||||
m_values.push_back(m_dataManager->variable(m_data));
|
||||
} else {
|
||||
setInvalid(tr("Variable \"%1\" not found").arg(m_data));
|
||||
if (rxVar.indexIn(m_data) != -1){
|
||||
QString var = rxVar.cap(1);
|
||||
if (m_dataManager->containsVariable(var)){
|
||||
m_values.push_back(m_dataManager->variable(var));
|
||||
} else {
|
||||
setInvalid(tr("Variable \"%1\" not found").arg(m_data));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Script:
|
||||
{
|
||||
QVariant value = sm.evaluateScript(m_data);
|
||||
if (value.isValid()){
|
||||
m_values.push_back(value);
|
||||
} else {
|
||||
setInvalid(tr("Wrong script syntax \"%1\" ").arg(m_data));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ContentItem:{
|
||||
ContentItemDesignIntf* item = dynamic_cast<ContentItemDesignIntf*>(band->childByName(m_data));
|
||||
QString itemName = m_data;
|
||||
ContentItemDesignIntf* item = dynamic_cast<ContentItemDesignIntf*>(band->childByName(itemName.remove('"')));
|
||||
if (item)
|
||||
m_values.push_back(item->content());
|
||||
else setInvalid(tr("Item \"%1\" not found").arg(m_data));
|
||||
else if (m_name.compare("COUNT",Qt::CaseInsensitive) == 0) {
|
||||
m_values.push_back(1);
|
||||
} else setInvalid(tr("Item \"%1\" not found").arg(m_data));
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -88,24 +114,27 @@ QVariant GroupFunction::multiplication(QVariant value1, QVariant value2)
|
||||
GroupFunction::GroupFunction(const QString &expression, const QString &dataBandName, DataSourceManager* dataManager)
|
||||
:m_dataBandName(dataBandName), m_dataManager(dataManager),m_isValid(true), m_errorMessage("")
|
||||
{
|
||||
m_data = expression;
|
||||
QRegExp rxField(Const::FIELD_RX,Qt::CaseInsensitive);
|
||||
if (rxField.indexIn(expression)>=0){
|
||||
m_dataType=Field;
|
||||
m_data = rxField.cap(1);
|
||||
QRegExp rxVariable(Const::VARIABLE_RX,Qt::CaseInsensitive);
|
||||
QRegExp rxScript(Const::SCRIPT_RX,Qt::CaseInsensitive);
|
||||
|
||||
if (rxScript.indexIn(expression) != -1){
|
||||
m_dataType = Script;
|
||||
return;
|
||||
}
|
||||
|
||||
QRegExp rxVariable(Const::VARIABLE_RX,Qt::CaseInsensitive);
|
||||
if (rxVariable.indexIn(expression)>=0){
|
||||
m_dataType=Variable;
|
||||
m_data = rxVariable.cap(1);
|
||||
if (rxField.indexIn(expression) != -1){
|
||||
m_dataType=Field;
|
||||
return;
|
||||
}
|
||||
|
||||
if (rxVariable.indexIn(expression) != -1){
|
||||
m_dataType = Variable;
|
||||
return;
|
||||
}
|
||||
|
||||
m_dataType = ContentItem;
|
||||
m_data = expression;
|
||||
m_data = m_data.remove('"');
|
||||
|
||||
}
|
||||
|
||||
GroupFunction *GroupFunctionFactory::createGroupFunction(const QString &functionName, const QString &expression, const QString& dataBandName, DataSourceManager *dataManager)
|
||||
|
@@ -42,7 +42,7 @@ class BandDesignIntf;
|
||||
class GroupFunction : public QObject{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum DataType{Variable,Field,Srcipt,ContentItem};
|
||||
enum DataType{Variable, Field, Script, ContentItem};
|
||||
GroupFunction(const QString& expression, const QString& dataBandName, DataSourceManager *dataManager);
|
||||
bool isValid(){return m_isValid;}
|
||||
void setInvalid(QString message){m_isValid=false,m_errorMessage=message;}
|
||||
|
@@ -113,157 +113,6 @@ void ItemDesignIntf::initFlags()
|
||||
}
|
||||
}
|
||||
|
||||
QString ContentItemDesignIntf::expandDataFields(QString context, ExpandType expandType, DataSourceManager* dataManager)
|
||||
{
|
||||
QRegExp rx(Const::FIELD_RX);
|
||||
|
||||
if (context.contains(rx)){
|
||||
while ((rx.indexIn(context))!=-1){
|
||||
QString field=rx.cap(1);
|
||||
|
||||
if (dataManager->containsField(field)) {
|
||||
QString fieldValue;
|
||||
m_varValue = dataManager->fieldData(field);
|
||||
if (expandType == EscapeSymbols) {
|
||||
if (dataManager->fieldData(field).isNull()) {
|
||||
fieldValue="\"\"";
|
||||
} else {
|
||||
fieldValue = escapeSimbols(m_varValue.toString());
|
||||
switch (dataManager->fieldData(field).type()) {
|
||||
case QVariant::Char:
|
||||
case QVariant::String:
|
||||
case QVariant::StringList:
|
||||
case QVariant::Date:
|
||||
case QVariant::DateTime:
|
||||
fieldValue = "\""+fieldValue+"\"";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (expandType == ReplaceHTMLSymbols)
|
||||
fieldValue = replaceHTMLSymbols(m_varValue.toString());
|
||||
else fieldValue = m_varValue.toString();
|
||||
}
|
||||
|
||||
context.replace(rx.cap(0),fieldValue);
|
||||
|
||||
} else {
|
||||
QString error = QString("Field %1 not found in %2 !!! ").arg(field).arg(this->objectName());
|
||||
dataManager->putError(error);
|
||||
if (!reportSettings() || !reportSettings()->suppressAbsentFieldsAndVarsWarnings())
|
||||
context.replace(rx.cap(0),error);
|
||||
else
|
||||
context.replace(rx.cap(0),"");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
QString ContentItemDesignIntf::expandUserVariables(QString context, RenderPass pass, ExpandType expandType, DataSourceManager* dataManager)
|
||||
{
|
||||
QRegExp rx(Const::VARIABLE_RX);
|
||||
if (context.contains(rx)){
|
||||
int pos = 0;
|
||||
while ((pos = rx.indexIn(context,pos))!=-1){
|
||||
QString variable=rx.cap(1);
|
||||
pos += rx.matchedLength();
|
||||
if (dataManager->containsVariable(variable) ){
|
||||
try {
|
||||
if (pass==dataManager->variablePass(variable)){
|
||||
m_varValue = dataManager->variable(variable);
|
||||
switch (expandType){
|
||||
case EscapeSymbols:
|
||||
context.replace(rx.cap(0),escapeSimbols(m_varValue.toString()));
|
||||
break;
|
||||
case NoEscapeSymbols:
|
||||
context.replace(rx.cap(0),m_varValue.toString());
|
||||
break;
|
||||
case ReplaceHTMLSymbols:
|
||||
context.replace(rx.cap(0),replaceHTMLSymbols(m_varValue.toString()));
|
||||
break;
|
||||
}
|
||||
pos=0;
|
||||
}
|
||||
} catch (ReportError e){
|
||||
dataManager->putError(e.what());
|
||||
if (!reportSettings() || reportSettings()->suppressAbsentFieldsAndVarsWarnings())
|
||||
context.replace(rx.cap(0),e.what());
|
||||
else
|
||||
context.replace(rx.cap(0),"");
|
||||
}
|
||||
} else {
|
||||
QString error;
|
||||
error = tr("Variable %1 not found").arg(variable);
|
||||
dataManager->putError(error);
|
||||
if (!reportSettings() || reportSettings()->suppressAbsentFieldsAndVarsWarnings())
|
||||
context.replace(rx.cap(0),error);
|
||||
else
|
||||
context.replace(rx.cap(0),"");
|
||||
}
|
||||
}
|
||||
}
|
||||
return context;
|
||||
}
|
||||
|
||||
QString ContentItemDesignIntf::expandScripts(QString context, DataSourceManager* dataManager)
|
||||
{
|
||||
QRegExp rx(Const::SCRIPT_RX);
|
||||
|
||||
if (context.contains(rx)){
|
||||
ScriptEngineManager::instance().setDataManager(dataManager);
|
||||
QScriptEngine* se = ScriptEngineManager::instance().scriptEngine();
|
||||
|
||||
QScriptValue svThis = se->globalObject().property("THIS");
|
||||
if (svThis.isValid()){
|
||||
se->newQObject(svThis, this);
|
||||
} else {
|
||||
svThis = se->newQObject(this);
|
||||
se->globalObject().setProperty("THIS",svThis);
|
||||
}
|
||||
|
||||
ScriptExtractor scriptExtractor(context);
|
||||
if (scriptExtractor.parse()){
|
||||
for(int i=0; i<scriptExtractor.count();++i){
|
||||
QString scriptBody = expandDataFields(scriptExtractor.bodyAt(i),EscapeSymbols, dataManager);
|
||||
scriptBody = expandUserVariables(scriptBody, FirstPass, EscapeSymbols, dataManager);
|
||||
QScriptValue value = se->evaluate(scriptBody);
|
||||
if (!se->hasUncaughtException()) {
|
||||
m_varValue = value.toVariant();
|
||||
context.replace(scriptExtractor.scriptAt(i),value.toString());
|
||||
} else {
|
||||
context.replace(scriptExtractor.scriptAt(i),se->uncaughtException().toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return context;
|
||||
}
|
||||
|
||||
QString ContentItemDesignIntf::content() const
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
QString ContentItemDesignIntf::escapeSimbols(const QString &value)
|
||||
{
|
||||
QString result = value;
|
||||
result.replace("\"","\\\"");
|
||||
result.replace('\n',"\\n");
|
||||
return result;
|
||||
}
|
||||
|
||||
QString ContentItemDesignIntf::replaceHTMLSymbols(const QString &value)
|
||||
{
|
||||
QString result = value;
|
||||
result.replace("<","<");
|
||||
result.replace(">",">");
|
||||
return result;
|
||||
}
|
||||
|
||||
Spacer::Spacer(QObject *owner, QGraphicsItem *parent)
|
||||
:ItemDesignIntf("Spacer",owner,parent){}
|
||||
|
||||
|
@@ -73,17 +73,8 @@ class ContentItemDesignIntf : public ItemDesignIntf
|
||||
public:
|
||||
ContentItemDesignIntf(const QString& xmlTypeName, QObject* owner = 0,QGraphicsItem* parent = 0)
|
||||
:ItemDesignIntf(xmlTypeName,owner,parent){}
|
||||
virtual QString content() const;
|
||||
virtual void setContent(const QString& value)=0;
|
||||
enum ExpandType {EscapeSymbols, NoEscapeSymbols, ReplaceHTMLSymbols};
|
||||
protected:
|
||||
QString escapeSimbols(const QString& value);
|
||||
QString replaceHTMLSymbols(const QString& value);
|
||||
virtual QString expandUserVariables(QString context, RenderPass pass, ExpandType expandType, DataSourceManager *dataManager);
|
||||
virtual QString expandDataFields(QString context, ExpandType expandType, DataSourceManager *dataManager);
|
||||
virtual QString expandScripts(QString context, DataSourceManager *dataManager);
|
||||
|
||||
QVariant m_varValue;
|
||||
virtual QString content() const = 0;
|
||||
virtual void setContent(const QString& value) = 0;
|
||||
};
|
||||
|
||||
class LayoutDesignIntf : public ItemDesignIntf{
|
||||
|
117
limereport/lritemscontainerdesignitf.cpp
Normal file
@@ -0,0 +1,117 @@
|
||||
#include "lritemscontainerdesignitf.h"
|
||||
#include "lritemdesignintf.h"
|
||||
|
||||
namespace LimeReport {
|
||||
|
||||
bool Segment::intersect(Segment value)
|
||||
{
|
||||
return ((value.m_end>=m_begin)&&(value.m_end<=m_end)) ||
|
||||
((value.m_begin>=m_begin)&&(value.m_end>=m_end)) ||
|
||||
((value.m_begin>=m_begin)&&(value.m_end<=m_end)) ||
|
||||
((value.m_begin<m_begin)&&(value.m_end>m_end)) ;
|
||||
}
|
||||
|
||||
qreal Segment::intersectValue(Segment value)
|
||||
{
|
||||
if ((value.m_end>=m_begin)&&(value.m_end<=m_end)){
|
||||
return value.m_end-m_begin;
|
||||
}
|
||||
if ((value.m_begin>=m_begin)&&(value.m_end>=m_end)){
|
||||
return m_end-value.m_begin;
|
||||
}
|
||||
if ((value.m_begin>=m_begin)&&(value.m_end<=m_end)){
|
||||
return value.m_end-value.m_begin;
|
||||
}
|
||||
if ((value.m_begin<m_begin)&&(value.m_end>m_end)){
|
||||
return m_end-m_begin;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool itemSortContainerLessThen(const PItemSortContainer c1, const PItemSortContainer c2)
|
||||
{
|
||||
VSegment vS1(c1->m_rect),vS2(c2->m_rect);
|
||||
HSegment hS1(c1->m_rect),hS2(c2->m_rect);
|
||||
if (vS1.intersectValue(vS2)>hS1.intersectValue(hS2))
|
||||
return c1->m_rect.x()<c2->m_rect.x();
|
||||
else return c1->m_rect.y()<c2->m_rect.y();
|
||||
}
|
||||
|
||||
void ItemsContainerDesignInft::snapshotItemsLayout()
|
||||
{
|
||||
m_containerItems.clear();
|
||||
foreach(BaseDesignIntf *childItem,childBaseItems()){
|
||||
m_containerItems.append(PItemSortContainer(new ItemSortContainer(childItem)));
|
||||
}
|
||||
qSort(m_containerItems.begin(),m_containerItems.end(),itemSortContainerLessThen);
|
||||
}
|
||||
|
||||
void ItemsContainerDesignInft::arrangeSubItems(RenderPass pass, DataSourceManager *dataManager, ArrangeType type)
|
||||
{
|
||||
bool needArrage=(type==Force);
|
||||
|
||||
foreach (PItemSortContainer item, m_containerItems) {
|
||||
if (item->m_item->isNeedUpdateSize(pass)){
|
||||
item->m_item->updateItemSize(dataManager, pass);
|
||||
needArrage=true;
|
||||
}
|
||||
}
|
||||
|
||||
if (needArrage){
|
||||
for (int i=0;i<m_containerItems.count();i++){
|
||||
for (int j=i;j<m_containerItems.count();j++){
|
||||
if ((i!=j) && (m_containerItems[i]->m_item->collidesWithItem(m_containerItems[j]->m_item))){
|
||||
HSegment hS1(m_containerItems[j]->m_rect),hS2(m_containerItems[i]->m_rect);
|
||||
VSegment vS1(m_containerItems[j]->m_rect),vS2(m_containerItems[i]->m_rect);
|
||||
if (m_containerItems[i]->m_rect.bottom()<m_containerItems[i]->m_item->geometry().bottom()){
|
||||
if (hS1.intersectValue(hS2)>vS1.intersectValue(vS2))
|
||||
m_containerItems[j]->m_item->setY(m_containerItems[i]->m_item->y()+m_containerItems[i]->m_item->height()
|
||||
+m_containerItems[j]->m_rect.top()-m_containerItems[i]->m_rect.bottom());
|
||||
|
||||
}
|
||||
if (m_containerItems[i]->m_rect.right()<m_containerItems[i]->m_item->geometry().right()){
|
||||
if (vS1.intersectValue(vS2)>hS1.intersectValue(hS2))
|
||||
m_containerItems[j]->m_item->setX(m_containerItems[i]->m_item->geometry().right()+
|
||||
(m_containerItems[j]->m_rect.x()-m_containerItems[i]->m_rect.right()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (needArrage||pass==FirstPass){
|
||||
int maxBottom = findMaxBottom();
|
||||
foreach(BaseDesignIntf* item,childBaseItems()){
|
||||
ItemDesignIntf* childItem=dynamic_cast<ItemDesignIntf*>(item);
|
||||
if (childItem){
|
||||
if (childItem->stretchToMaxHeight())
|
||||
childItem->setHeight(maxBottom-childItem->geometry().top());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
qreal ItemsContainerDesignInft::findMaxBottom()
|
||||
{
|
||||
qreal maxBottom=0;
|
||||
foreach(QGraphicsItem* item,childItems()){
|
||||
BaseDesignIntf* subItem = dynamic_cast<BaseDesignIntf *>(item);
|
||||
if(subItem)
|
||||
if ( subItem->isVisible() && (subItem->geometry().bottom()>maxBottom) )
|
||||
maxBottom=subItem->geometry().bottom();
|
||||
}
|
||||
return maxBottom;
|
||||
}
|
||||
|
||||
qreal ItemsContainerDesignInft::findMaxHeight()
|
||||
{
|
||||
qreal maxHeight=0;
|
||||
foreach(QGraphicsItem* item,childItems()){
|
||||
BaseDesignIntf* subItem = dynamic_cast<BaseDesignIntf *>(item);
|
||||
if(subItem)
|
||||
if (subItem->geometry().height()>maxHeight) maxHeight=subItem->geometry().height();
|
||||
}
|
||||
return maxHeight;
|
||||
}
|
||||
|
||||
} // namespace LimeReport
|